Module: Decidim::OrdersHelper
- Included in:
- Budgets::BudgetsListCell
- Defined in:
- decidim-core/app/helpers/decidim/orders_helper.rb
Overview
Helper that provides methods to render order selector and links
Instance Method Summary collapse
-
#order_link(order, options = {}) ⇒ Object
Public: Returns a resource url merging current params with order.
-
#order_selector(orders, options = {}) ⇒ Object
Public: It renders the order selector for the provided orders (Note) This method requires the javascript ‘decidim/orders’ to be present in the page.
Instance Method Details
#order_link(order, options = {}) ⇒ Object
Public: Returns a resource url merging current params with order
order - The name of the order criteria. i.e. ‘random’ options - An optional hash of options
* i18n_scope - The scope of the i18n translations
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'decidim-core/app/helpers/decidim/orders_helper.rb', line 25 def order_link(order, = {}) i18n_scope = .delete(:i18n_scope) link_to( t("#{i18n_scope}.#{order}"), url_for(params.to_unsafe_h.except( "component_id", "participatory_process_slug", "assembly_slug", "initiative_slug" ).merge(page: nil, order:)), { data: { order: }, remote: true }.merge() ) end |
#order_selector(orders, options = {}) ⇒ Object
Public: It renders the order selector for the provided orders (Note) This method requires the javascript ‘decidim/orders’ to be present in the page.
orders - An array of order criteria options - An optional hash of options
* i18n_scope - The scope of the i18n translations
13 14 15 16 17 18 |
# File 'decidim-core/app/helpers/decidim/orders_helper.rb', line 13 def order_selector(orders, = {}) render partial: "decidim/shared/orders", locals: { orders:, i18n_scope: [:i18n_scope] } end |