Class: Decidim::Debates::DebateForm
- Inherits:
-
Form
- Object
- AttributeObject::Form
- Form
- Decidim::Debates::DebateForm
- Includes:
- AttachmentAttributes, HasTaxonomyFormAttributes, HasUploadValidations, TranslatableAttributes
- Defined in:
- decidim-debates/app/forms/decidim/debates/debate_form.rb
Overview
This class holds a Form to create/update debates from Decidim’s public views.
Constant Summary
Constants included from AttributeObject::TypeMap
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Attribute Summary
Attributes inherited from AttributeObject::Form
Instance Method Summary collapse
Methods included from TranslatableAttributes
Methods included from HasUploadValidations
#attached_uploader, #maximum_avatar_size, #maximum_upload_size
Methods inherited from AttributeObject::Form
ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
Methods included from AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#debate ⇒ Object
38 39 40 |
# File 'decidim-debates/app/forms/decidim/debates/debate_form.rb', line 38 def debate @debate ||= Debate.find_by(id:) end |
#map_model(debate) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'decidim-debates/app/forms/decidim/debates/debate_form.rb', line 23 def map_model(debate) super # Debates can be translated in different languages from the admin but # the public form does not allow it. When a user creates a debate the # user locale is taken as the text locale. self.title = debate.title.values.first self.description = debate.description.values.first self.user_group_id = debate.decidim_user_group_id self.documents = debate. end |
#participatory_space_manifest ⇒ Object
34 35 36 |
# File 'decidim-debates/app/forms/decidim/debates/debate_form.rb', line 34 def participatory_space_manifest @participatory_space_manifest ||= current_component.participatory_space.manifest.name end |