Sha256: 8fbfa85144a6294755d825208300fc094a00eeafd4ace380aa085f7bbc6ac0bd

Contents?: true

Size: 627 Bytes

Versions: 62

Compression:

Stored size: 627 Bytes

Contents

module Workarea
  module Storefront
    module PaginationHelper
      def pagination_path_for(page: 1)
        new_query_string_params = request.query_parameters.merge(page: page)
        "#{request.path}?#{new_query_string_params.to_query}"
      end

      def pagination_data(collection)
        {
          currentPage: collection.current_page,
          lastPage: collection.last_page?,
          nextPageUrl: pagination_path_for(page: collection.current_page + 1)
        }.to_json
      end

      def show_pagination?(collection)
        collection.total_pages > 1 && !collection.last_page?
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.5.4 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.26 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.5.3 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.25 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.5.2 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.24 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.5.1 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.23 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.22 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.5.0 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.21 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.5.0.beta.1 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.20 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.19 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.18 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.17 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.16 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.15 app/helpers/workarea/storefront/pagination_helper.rb
workarea-storefront-3.4.14 app/helpers/workarea/storefront/pagination_helper.rb