Class: Decidim::Proposals::ProposalForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Proposals::ProposalForm
- Defined in:
- app/forms/decidim/proposals/proposal_form.rb
Overview
A form object to be used when public users want to create a proposal.
Instance Method Summary collapse
-
#category ⇒ Object
Finds the Category from the category_id.
- #has_address? ⇒ Boolean
- #organization_scopes ⇒ Object
- #process_scope ⇒ Object
-
#scope ⇒ Object
Finds the Scope from the scope_id.
Instance Method Details
#category ⇒ Object
Finds the Category from the category_id.
Returns a Decidim::Category
42 43 44 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 42 def category @category ||= categories.where(id: category_id).first end |
#has_address? ⇒ Boolean
53 54 55 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 53 def has_address? current_feature.settings.geocoding_enabled? && has_address end |
#organization_scopes ⇒ Object
29 30 31 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 29 def organization_scopes current_organization.scopes end |
#process_scope ⇒ Object
33 34 35 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 33 def process_scope current_feature.participatory_process.scope end |
#scope ⇒ Object
Finds the Scope from the scope_id.
Returns a Decidim::Scope
49 50 51 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 49 def scope @scope ||= process_scope || organization_scopes.where(id: scope_id).first end |