Class: Decidim::Budgets::Admin::ProjectImportProposalsForm
- Inherits:
-
Form
- Object
- AttributeObject::Form
- Form
- Decidim::Budgets::Admin::ProjectImportProposalsForm
- Defined in:
- decidim-budgets/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.
Constant Summary
Constants included from AttributeObject::TypeMap
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Attribute Summary
Attributes inherited from AttributeObject::Form
Instance Method Summary collapse
- #budget ⇒ Object
- #origin_component ⇒ Object
- #origin_components ⇒ Object
- #origin_components_collection ⇒ Object
Methods inherited from AttributeObject::Form
ensure_hash, from_model, from_params, hash_from, infer_model_name, #map_model, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
Methods included from AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#budget ⇒ Object
33 34 35 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 33 def budget @budget ||= context[:budget] end |
#origin_component ⇒ Object
19 20 21 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 19 def origin_component @origin_component ||= origin_components.find_by(id: origin_component_id) end |
#origin_components ⇒ Object
23 24 25 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 23 def origin_components @origin_components ||= current_participatory_space.components.where(manifest_name: :proposals) end |
#origin_components_collection ⇒ Object
27 28 29 30 31 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_import_proposals_form.rb', line 27 def origin_components_collection origin_components.map do |component| [component.name[I18n.locale.to_s], component.id] end end |