Class: Decidim::Proposals::ProposalForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Proposals::ProposalForm
- Includes:
- AttachmentAttributes, HasTaxonomyFormAttributes, HasUploadValidations, TranslatableAttributes
- Defined in:
- app/forms/decidim/proposals/proposal_form.rb
Overview
A form object to be used when public users want to create a proposal.
Direct Known Subclasses
Instance Method Summary collapse
- #geocoded? ⇒ Boolean
- #geocoding_enabled? ⇒ Boolean
- #has_address? ⇒ Boolean
- #map_model(model) ⇒ Object
- #participatory_space_manifest ⇒ Object
Instance Method Details
#geocoded? ⇒ Boolean
60 61 62 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 60 def geocoded? latitude.present? && longitude.present? end |
#geocoding_enabled? ⇒ Boolean
52 53 54 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 52 def geocoding_enabled? Decidim::Map.available?(:geocoding) && current_component.settings.geocoding_enabled? end |
#has_address? ⇒ Boolean
56 57 58 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 56 def has_address? geocoding_enabled? && address.present? end |
#map_model(model) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 38 def map_model(model) self.title = translated_attribute(model.title) self.body = translated_attribute(model.body) presenter = ProposalPresenter.new(model) self.body = presenter.editor_body(all_locales: body.is_a?(Hash)) self.documents = model. end |
#participatory_space_manifest ⇒ Object
48 49 50 |
# File 'app/forms/decidim/proposals/proposal_form.rb', line 48 def participatory_space_manifest @participatory_space_manifest ||= current_component.participatory_space.manifest.name end |