Class: Decidim::Debates::Admin::DebateForm

Inherits:
Form show all
Includes:
AttachmentAttributes, HasTaxonomyFormAttributes, HasUploadValidations, TranslatableAttributes
Defined in:
decidim-debates/app/forms/decidim/debates/admin/debate_form.rb

Overview

This class holds a Form to create/update debates from Decidim’s admin panel.

Constant Summary

Constants included from AttributeObject::TypeMap

AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal

Instance Attribute Summary

Attributes inherited from AttributeObject::Form

#context

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

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

#map_model(model) ⇒ Object



33
34
35
36
37
38
39
40
# File 'decidim-debates/app/forms/decidim/debates/admin/debate_form.rb', line 33

def map_model(model)
  self.finite = model.start_time.present? && model.end_time.present?
  presenter = DebatePresenter.new(model)

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

#participatory_space_manifestObject



42
43
44
# File 'decidim-debates/app/forms/decidim/debates/admin/debate_form.rb', line 42

def participatory_space_manifest
  @participatory_space_manifest ||= current_component.participatory_space.manifest.name
end