Sha256: 2dbecda4f89ad51bf5fc63434edc21a1e5150ff0bdd5564eacfad063cb814d50

Contents?: true

Size: 1.84 KB

Versions: 62

Compression:

Stored size: 1.84 KB

Contents

- number_of_pages = collection.total_pages
- current_page = collection.current_page

%ul.sitemap-pagination
  %li.sitemap-pagination__node
    - if collection.first_page?
      %span.sitemap-pagination__navigation.sitemap-pagination__navigation--disabled= t('workarea.storefront.sitemaps.pagination.prev')
    - else
      = link_to t('workarea.storefront.sitemaps.pagination.prev'), pagination_path_for(page: current_page - 1), class: 'sitemap-pagination__navigation'
  - max_page = [current_page + 1, 3].max
  - start = [1, current_page - 1].max
  - if start > number_of_pages - 3 && start >= 2
    - start = number_of_pages - 2
  - stop = [max_page, number_of_pages].min
  - if start > 1
    %li.sitemap-pagination__node= link_to 1, pagination_path_for(page: 1), class: 'sitemap-pagination__link'
    - if start == 3
      %li.sitemap-pagination__node= link_to 2, pagination_path_for(page: 2), class: 'sitemap-pagination__link'
    - if start >= 4
      %li.sitemap-pagination__node
        %span …
  - Range.new(start, stop).each do |page|
    - if page == current_page
      %li.sitemap-pagination__node
        %strong= page
    - else
      %li.sitemap-pagination__node= link_to page, pagination_path_for(page: page), class: 'sitemap-pagination__link'
  - if stop < number_of_pages
    - if (stop + 1) != number_of_pages
      %li.sitemap-pagination__node
        %span …
    %li.sitemap-pagination__node= link_to number_of_pages, pagination_path_for(page: number_of_pages), class: 'sitemap-pagination__link'
  %li.sitemap-pagination__node
    - if collection.last_page?
      %span.sitemap-pagination__navigation.sitemap-pagination__navigation--disabled= t('workarea.storefront.sitemaps.pagination.next')
    - else
      = link_to t('workarea.storefront.sitemaps.pagination.next'), pagination_path_for(page: current_page + 1), class: 'sitemap-pagination__navigation'

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.26 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.45 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.25 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.23 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.44 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.22 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.43 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.21 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.42 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.20 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.41 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.19 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.40 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.18 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.39 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.17 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.38 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.5.16 app/views/workarea/storefront/sitemaps/_pagination.html.haml
workarea-storefront-3.4.37 app/views/workarea/storefront/sitemaps/_pagination.html.haml