Module: Decidim::Sortitions::Admin::SortitionsHelper

Includes:
PaginateHelper, TranslationsHelper
Defined in:
app/helpers/decidim/sortitions/admin/sortitions_helper.rb

Instance Method Summary collapse

Instance Method Details

#components_options(components) ⇒ Object

Converts a list of components into a list of selectable options



11
12
13
14
15
# File 'app/helpers/decidim/sortitions/admin/sortitions_helper.rb', line 11

def components_options(components)
  components.map do |f|
    [translated_attribute(f.name), f.id]
  end
end

#sortition_category(sortition) ⇒ Object



17
18
19
20
21
# File 'app/helpers/decidim/sortitions/admin/sortitions_helper.rb', line 17

def sortition_category(sortition)
  return translated_attribute sortition.category&.name if sortition.category

  I18n.t("sortitions.form.all_categories", scope: "decidim.sortitions.admin")
end