Class: Decidim::Meetings::Admin::QuestionForm

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
app/forms/decidim/meetings/admin/question_form.rb

Overview

This class holds a Form to update questionnaire questions from Decidim’s admin panel.

Instance Method Summary collapse

Instance Method Details

#editable?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/forms/decidim/meetings/admin/question_form.rb', line 32

def editable?
  @editable ||= id.blank? || Decidim::Meetings::Question.unpublished.unanswered.exists?(id:)
end

#number_of_optionsObject



36
37
38
# File 'app/forms/decidim/meetings/admin/question_form.rb', line 36

def number_of_options
  answer_options.size
end

#to_paramObject



26
27
28
29
30
# File 'app/forms/decidim/meetings/admin/question_form.rb', line 26

def to_param
  return id if id.present?

  "questionnaire-question-id"
end