Sha256: e11e45d8f1562ee85bb118862f690c2d5c1f46ac3c2f081277bcf0fd9f956286

Contents?: true

Size: 931 Bytes

Versions: 3

Compression:

Stored size: 931 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Helper to paginate collections.
  module PaginateHelper
    # Displays pagination links for the given collection, setting the correct
    # theme. This mostly acts as a proxy for the underlying pagination engine.
    #
    # collection - a collection of elements that need to be paginated
    # paginate_params - a Hash with options to delegate to the pagination helper.
    def decidim_paginate(collection, paginate_params = {})
      # Kaminari uses url_for to generate the url, but this doesn't play nice with our engine system
      # and unless we remove these params they are added again as query string :(
      default_params = {
        participatory_process_slug: nil,
        assembly_slug: nil,
        initiative_slug: nil,
        component_id: nil
      }

      paginate collection, theme: "decidim", params: paginate_params.merge(default_params)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.23.1 app/helpers/decidim/paginate_helper.rb
decidim-core-0.23.1.rc1 app/helpers/decidim/paginate_helper.rb
decidim-core-0.23.0 app/helpers/decidim/paginate_helper.rb