Class: Decidim::Elections::Admin::AnswerImportProposalsForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Elections::Admin::AnswerImportProposalsForm
- Defined in:
- app/forms/decidim/elections/admin/answer_import_proposals_form.rb
Overview
A form object to be used when admin users want to import a collection of proposals from another component into answers resource.
Instance Method Summary collapse
- #election ⇒ Object
- #origin_component ⇒ Object
- #origin_components ⇒ Object
- #origin_components_collection ⇒ Object
- #question ⇒ Object
Instance Method Details
#election ⇒ Object
31 32 33 |
# File 'app/forms/decidim/elections/admin/answer_import_proposals_form.rb', line 31 def election @election ||= context[:election] end |
#origin_component ⇒ Object
17 18 19 |
# File 'app/forms/decidim/elections/admin/answer_import_proposals_form.rb', line 17 def origin_component @origin_component ||= origin_components.find_by(id: origin_component_id) end |
#origin_components ⇒ Object
21 22 23 |
# File 'app/forms/decidim/elections/admin/answer_import_proposals_form.rb', line 21 def origin_components @origin_components ||= current_participatory_space.components.where(manifest_name: :proposals) end |
#origin_components_collection ⇒ Object
25 26 27 28 29 |
# File 'app/forms/decidim/elections/admin/answer_import_proposals_form.rb', line 25 def origin_components_collection origin_components.map do |component| [component.name[I18n.locale.to_s], component.id] end end |
#question ⇒ Object
35 36 37 |
# File 'app/forms/decidim/elections/admin/answer_import_proposals_form.rb', line 35 def question @question ||= context[:question] end |