Class: Decidim::Proposals::Admin::ProposalForm

Inherits:
ProposalBaseForm show all
Includes:
AttachmentAttributes, HasUploadValidations
Defined in:
app/forms/decidim/proposals/admin/proposal_form.rb

Overview

A form object to be used when admin users want to create a proposal.

Instance Method Summary collapse

Methods inherited from ProposalBaseForm

#author, #geocoded?, #geocoding_enabled?, #has_address?, #meeting_as_author, #meetings, #participatory_space_manifest

Instance Method Details

#map_model(model) ⇒ Object



24
25
26
27
28
29
30
31
# File 'app/forms/decidim/proposals/admin/proposal_form.rb', line 24

def map_model(model)
  super
  presenter = ProposalPresenter.new(model)

  self.title = presenter.title(all_locales: title.is_a?(Hash))
  self.body = presenter.editor_body(all_locales: body.is_a?(Hash))
  self.documents = model.attachments
end

#notify_missing_attachment_if_erroredObject



33
34
35
# File 'app/forms/decidim/proposals/admin/proposal_form.rb', line 33

def notify_missing_attachment_if_errored
  errors.add(:add_documents, :needs_to_be_reattached) if errors.any? && add_documents.present?
end