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
42 43 44 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 42 def category @category ||= context.current_feature.categories.where(id: decidim_category_id).first end |
#map_model(model) ⇒ Object
26 27 28 |
# File 'decidim-budgets/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) end |
#process_scope ⇒ Object
30 31 32 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 30 def process_scope current_feature.participatory_process.scope end |
#proposals ⇒ Object
34 35 36 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 34 def proposals @proposals ||= Decidim.find_resource_manifest(:proposals).try(:resource_scope, context.current_feature)&.order(title: :asc)&.pluck(:title, :id) end |
#scope ⇒ Object
38 39 40 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb', line 38 def scope @scope ||= process_scope || current_organization.scopes.where(id: decidim_scope_id).first end |