Class: Decidim::Budgets::Admin::ProjectForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Budgets::Admin::ProjectForm
- Includes:
- TranslatableAttributes, TranslationsHelper
- Defined in:
- decidim-budgets/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
41 42 43 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 41 def category @category ||= context.current_feature.categories.where(id: decidim_category_id).first end |
#map_model(model) ⇒ Object
25 26 27 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 25 def map_model(model) self.proposal_ids = model.linked_resources(:proposals, "included_proposals").pluck(:id) end |
#process_scope ⇒ Object
29 30 31 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 29 def process_scope current_feature.participatory_process.scope end |
#proposals ⇒ Object
33 34 35 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 33 def proposals @proposals ||= Decidim.find_resource_manifest(:proposals).try(:resource_scope, context.current_feature)&.order(title: :asc)&.pluck(:title, :id) end |
#scope ⇒ Object
37 38 39 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 37 def scope @scope ||= process_scope || current_organization.scopes.where(id: decidim_scope_id).first end |