Module: Decidim::Forms::Admin::ApplicationHelper
- Defined in:
- app/helpers/decidim/forms/admin/application_helper.rb
Overview
Custom helpers, scoped to the forms engine.
Instance Method Summary collapse
- #dynamic_title(title, **options) ⇒ Object
- #tabs_id_for_question(question) ⇒ Object
- #tabs_id_for_question_answer_option(question, answer_option) ⇒ Object
- #tabs_id_for_question_display_condition(question, display_condition) ⇒ Object
- #tabs_id_for_question_matrix_row(question, matrix_row) ⇒ Object
- #template?(questionnaire_for) ⇒ Boolean
- #templates_defined? ⇒ Boolean
Instance Method Details
#dynamic_title(title, **options) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 27 def dynamic_title(title, **) data = { "max-length" => [:max_length], "omission" => [:omission], "placeholder" => [:placeholder], "locale" => I18n.locale } tag.span(class: [:class], data:) do truncate translated_attribute(title), length: [:max_length], omission: [:omission] end end |
#tabs_id_for_question(question) ⇒ Object
11 12 13 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 11 def tabs_id_for_question(question) "questionnaire_question_#{question.to_param}" end |
#tabs_id_for_question_answer_option(question, answer_option) ⇒ Object
15 16 17 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 15 def tabs_id_for_question_answer_option(question, answer_option) "questionnaire_question_#{question.to_param}_answer_option_#{answer_option.to_param}" end |
#tabs_id_for_question_display_condition(question, display_condition) ⇒ Object
19 20 21 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 19 def tabs_id_for_question_display_condition(question, display_condition) "questionnaire_question_#{question.to_param}_display_condition_#{display_condition.to_param}" end |
#tabs_id_for_question_matrix_row(question, matrix_row) ⇒ Object
23 24 25 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 23 def tabs_id_for_question_matrix_row(question, matrix_row) "questionnaire_question_#{question.to_param}_matrix_row_#{matrix_row.to_param}" end |
#template?(questionnaire_for) ⇒ Boolean
39 40 41 42 43 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 39 def template?(questionnaire_for) return unless defined? Decidim::Templates::Template questionnaire_for.is_a? Decidim::Templates::Template end |
#templates_defined? ⇒ Boolean
45 46 47 |
# File 'app/helpers/decidim/forms/admin/application_helper.rb', line 45 def templates_defined? defined? Decidim::Templates::Admin::Concerns::Templatable end |