Module: Decidim::Consultations::Admin::QuestionsHelper

Includes:
TranslationsHelper
Defined in:
decidim-consultations/app/helpers/decidim/consultations/admin/questions_helper.rb

Overview

Helper for questions controller

Defined Under Namespace

Classes: Option

Instance Method Summary collapse

Methods included from TranslationsHelper

empty_translatable, ensure_translatable, multi_translation, translated_in_current_locale?

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#question_example_slugObject



12
13
14
# File 'decidim-consultations/app/helpers/decidim/consultations/admin/questions_helper.rb', line 12

def question_example_slug
  "question-#{Time.now.utc.year}-#{Time.now.utc.month}-1"
end

#question_response_groups(question = current_question) ⇒ Object



16
17
18
19
20
21
# File 'decidim-consultations/app/helpers/decidim/consultations/admin/questions_helper.rb', line 16

def question_response_groups(question = current_question)
  [Option.new("", "-")] +
    question.response_groups.map do |group|
      Option.new(group.id, translated_attribute(group.title))
    end
end