Module: Decidim::Surveys::Admin::ApplicationHelper

Defined in:
app/helpers/decidim/surveys/admin/application_helper.rb

Overview

Custom helpers, scoped to the surveys engine.

Instance Method Summary collapse

Instance Method Details

#disabled_for_question(survey, question) ⇒ Object



29
30
31
# File 'app/helpers/decidim/surveys/admin/application_helper.rb', line 29

def disabled_for_question(survey, question)
  !question.persisted? || !survey.questions_editable?
end

#mandatory_id_for_question(question) ⇒ Object



19
20
21
22
# File 'app/helpers/decidim/surveys/admin/application_helper.rb', line 19

def mandatory_id_for_question(question)
  return "survey_questions_#{question.id}_mandatory" if question.persisted?
  "${tabsId}_mandatory"
end

#question_type_id_for_question(question) ⇒ Object



24
25
26
27
# File 'app/helpers/decidim/surveys/admin/application_helper.rb', line 24

def question_type_id_for_question(question)
  return "survey_questions_#{question.id}_question_type" if question.persisted?
  "${tabsId}_question_type"
end

#tabs_id_for_question(question) ⇒ Object



9
10
11
12
# File 'app/helpers/decidim/surveys/admin/application_helper.rb', line 9

def tabs_id_for_question(question)
  return "survey-question-#{question.id}" if question.persisted?
  "${tabsId}"
end

#tabs_id_for_question_answer_option(question, idx) ⇒ Object



14
15
16
17
# File 'app/helpers/decidim/surveys/admin/application_helper.rb', line 14

def tabs_id_for_question_answer_option(question, idx)
  return "survey-question-answer-option-#{question.id}-#{idx}" if question.present?
  "${tabsId}"
end