Class: Decidim::Debates::DebateForm

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

Overview

This class holds a Form to create/update debates from Decidim’s public views.

Instance Method Summary collapse

Instance Method Details

#debateObject



38
39
40
# File '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 '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.attachments
end

#participatory_space_manifestObject



34
35
36
# File 'app/forms/decidim/debates/debate_form.rb', line 34

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