Sha256: 5d6ded5e92e25f38a3fac8efaac655efa4378cbf2459710f0b49164a042a7d44

Contents?: true

Size: 677 Bytes

Versions: 6

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Sortitions
    module Admin
      module SortitionsHelper
        include Decidim::TranslationsHelper
        include Decidim::PaginateHelper

        # Converts a list of components into a list of selectable options
        def components_options(components)
          components.map do |f|
            [translated_attribute(f.name), f.id]
          end
        end

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-sortitions-0.29.1 app/helpers/decidim/sortitions/admin/sortitions_helper.rb
decidim-sortitions-0.29.0 app/helpers/decidim/sortitions/admin/sortitions_helper.rb
decidim-sortitions-0.29.0.rc4 app/helpers/decidim/sortitions/admin/sortitions_helper.rb
decidim-sortitions-0.29.0.rc3 app/helpers/decidim/sortitions/admin/sortitions_helper.rb
decidim-sortitions-0.29.0.rc2 app/helpers/decidim/sortitions/admin/sortitions_helper.rb
decidim-sortitions-0.29.0.rc1 app/helpers/decidim/sortitions/admin/sortitions_helper.rb