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.23.3 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.23.2 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.23.1 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.23.1.rc1 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.23.0 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb
decidim-proposals-0.22.0 app/helpers/decidim/proposals/admin/proposals_picker_helper.rb