Class: Decidim::Debates::CloseDebateForm

Inherits:
Form
  • Object
show all
Defined in:
decidim-debates/app/forms/decidim/debates/close_debate_form.rb

Overview

This class holds a Form to close debates from Decidim's public views.

Instance Method Summary collapse

Instance Method Details

#closed_atObject


16
17
18
# File 'decidim-debates/app/forms/decidim/debates/close_debate_form.rb', line 16

def closed_at
  debate&.closed_at || Time.current
end

#map_model(debate) ⇒ Object


20
21
22
23
24
25
26
27
28
# File 'decidim-debates/app/forms/decidim/debates/close_debate_form.rb', line 20

def map_model(debate)
  super
  self.debate = debate

  # Debates can be translated in different languages from the admin but
  # the public form doesn't allow it. When a user closes a debate the
  # user locale is taken as the text locale.
  self.conclusions = debate.conclusions&.values&.first
end