Sha256: c24e753349afd8296e515157e19f3569c1d60c23d1bd5ea5664a6f1724641c0e

Contents?: true

Size: 829 Bytes

Versions: 46

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      # This class contains helpers needed to show the Proposals picker.
      #
      module ProposalsPickerHelper
        def proposals_picker(form, field, url)
          picker_options = {
            id: sanitize_to_id(field),
            class: "picker-multiple",
            name: "#{form.object_name}[#{field.to_s.sub(/s$/, "_ids")}]",
            multiple: true,
            autosort: true
          }

          prompt_params = {
            url: url,
            text: t("proposals_picker.choose_proposals", scope: "decidim.proposals")
          }

          form.data_picker(field, picker_options, prompt_params) do |item|
            { url: url, text: present(item).id_and_title }
          end
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-proposals-0.27.9 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.8 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.7 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.6 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.10 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.9 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.5 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.8 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.4 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.3 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.7 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.5 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.2 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.1 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.4 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.0 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.3 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.0.rc2 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.27.0.rc1 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.26.2 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb