Class: Decidim::Templates::Admin::ProposalAnswerTemplateForm
- Inherits:
-
TemplateForm
- Object
- Form
- TemplateForm
- Decidim::Templates::Admin::ProposalAnswerTemplateForm
- Defined in:
- app/forms/decidim/templates/admin/proposal_answer_template_form.rb
Instance Method Summary collapse
- #component_has_been_selected ⇒ Object
- #map_model(model) ⇒ Object
- #proposal_state_id_is_valid ⇒ Object
- #skip_name_validation ⇒ Object
Instance Method Details
#component_has_been_selected ⇒ Object
30 31 32 |
# File 'app/forms/decidim/templates/admin/proposal_answer_template_form.rb', line 30 def component_has_been_selected errors.add(:select_component, :blank) if select_component end |
#map_model(model) ⇒ Object
14 15 16 17 |
# File 'app/forms/decidim/templates/admin/proposal_answer_template_form.rb', line 14 def map_model(model) self.proposal_state_id = model.field_values["proposal_state_id"]&.to_i self.component_constraint = model.templatable&.id end |
#proposal_state_id_is_valid ⇒ Object
23 24 25 26 27 28 |
# File 'app/forms/decidim/templates/admin/proposal_answer_template_form.rb', line 23 def proposal_state_id_is_valid if Decidim::Proposals::ProposalState.where(decidim_component_id: component_constraint).find_by(id: proposal_state_id).blank? errors.add(:proposal_state_id, :blank) end end |
#skip_name_validation ⇒ Object
19 20 21 |
# File 'app/forms/decidim/templates/admin/proposal_answer_template_form.rb', line 19 def skip_name_validation select_component end |