Sha256: 88281699d31d0c53cb5f7cd230c8da0a613c249217ffbebde88a451042ab6b95
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true module Decidim module Plans module LinksHelper # This is for generating the links so that they maintain the search status def request_params(extra_params={}, exclude_params=[]) @request_params ||= request.params.except( *(exclude_params + [ :action, :component_id, :controller, :assembly_slug, :participatory_process_slug, :id ]) ).merge(prepare_extra_params(extra_params)) end def request_params_query(extra_params={}, exclude_params=[]) return "" unless request_params(extra_params, exclude_params).any? "?#{request_params.to_query}" end private # Adds the random seed to the extra parameters to maintain the ordering # correctly across the requests. def prepare_extra_params(extra_params) return extra_params unless controller return extra_params unless controller.respond_to?(:order, true) return extra_params unless controller.respond_to?(:random_seed, true) order = controller.send(:order) return extra_params unless order == "random" seed = controller.send(:random_seed) return extra_params unless seed extra_params.merge(random_seed: seed) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-plans-0.16.5 | app/helpers/decidim/plans/links_helper.rb |