Class: Decidim::Budgets::Admin::ProjectImportProposalsForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Budgets::Admin::ProjectImportProposalsForm
- Defined in:
- app/forms/decidim/budgets/admin/project_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 projects component.
Instance Method Summary collapse
- #budget ⇒ Object
- #origin_component ⇒ Object
- #origin_components ⇒ Object
- #origin_components_collection ⇒ Object
- #scope ⇒ Object
- #scope_id ⇒ Object
Instance Method Details
#budget ⇒ Object
44 45 46 |
# File 'app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 44 def budget @budget ||= context[:budget] end |
#origin_component ⇒ Object
22 23 24 |
# File 'app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 22 def origin_component @origin_component ||= origin_components.find_by(id: origin_component_id) end |
#origin_components ⇒ Object
26 27 28 |
# File 'app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 26 def origin_components @origin_components ||= current_participatory_space.components.where(manifest_name: :proposals) end |
#origin_components_collection ⇒ Object
30 31 32 33 34 |
# File 'app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 30 def origin_components_collection origin_components.map do |component| [component.name[I18n.locale.to_s], component.id] end end |
#scope ⇒ Object
36 37 38 |
# File 'app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 36 def scope @scope ||= @scope_id ? current_component.scopes.find_by(id: @scope_id) : current_component.scope end |
#scope_id ⇒ Object
40 41 42 |
# File 'app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 40 def scope_id @scope_id || scope&.id end |