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

Inherits:
ProposalBaseForm show all
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, #category, #component_automatic_hashtags, #component_suggested_hashtags, #extra_hashtags, #geocoded?, #geocoding_enabled?, #has_address?, #meeting_as_author, #meetings, #scope, #scope_id, #suggested_hashtag_checked?, #suggested_hashtags

Instance Method Details

#map_model(model) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/forms/decidim/proposals/admin/proposal_form.rb', line 17

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

  self.title = presenter.title(all_locales: title.is_a?(Hash))
  self.body = presenter.body(all_locales: body.is_a?(Hash))
  self.attachment = if model.documents.first.present?
                      { file: model.documents.first.file, title: translated_attribute(model.documents.first.title) }
                    else
                      {}
                    end
end