Class: Decidim::Budgets::Admin::ProjectForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Budgets::Admin::ProjectForm
- Includes:
- TranslatableAttributes, TranslationsHelper
- Defined in:
- app/forms/decidim/budgets/admin/project_form.rb
Overview
This class holds a Form to create/update projects from Decidim’s admin panel.
Instance Method Summary collapse
- #category ⇒ Object
- #map_model(model) ⇒ Object
- #process_scope ⇒ Object
- #proposals ⇒ Object
- #scope ⇒ Object
Instance Method Details
#category ⇒ Object
46 47 48 |
# File 'app/forms/decidim/budgets/admin/project_form.rb', line 46 def category @category ||= context.current_feature.categories.where(id: decidim_category_id).first end |
#map_model(model) ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/forms/decidim/budgets/admin/project_form.rb', line 26 def map_model(model) self.proposal_ids = model.linked_resources(:proposals, "included_proposals").pluck(:id) return unless model.categorization self.decidim_category_id = model.categorization.decidim_category_id end |
#process_scope ⇒ Object
34 35 36 |
# File 'app/forms/decidim/budgets/admin/project_form.rb', line 34 def process_scope current_feature.participatory_space.scope end |
#proposals ⇒ Object
38 39 40 |
# File 'app/forms/decidim/budgets/admin/project_form.rb', line 38 def proposals @proposals ||= Decidim.find_resource_manifest(:proposals).try(:resource_scope, context.current_feature)&.order(title: :asc)&.pluck(:title, :id) end |
#scope ⇒ Object
42 43 44 |
# File 'app/forms/decidim/budgets/admin/project_form.rb', line 42 def scope @scope ||= current_organization.scopes.where(id: decidim_scope_id).first || process_scope end |