Class: Decidim::Forms::Admin::QuestionnaireAnswerPresenter
- Inherits:
-
Rectify::Presenter
- Object
- Rectify::Presenter
- Decidim::Forms::Admin::QuestionnaireAnswerPresenter
- Includes:
- TranslatableAttributes
- Defined in:
- app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb
Overview
Presenter for questionnaire answer
Instance Method Summary collapse
Instance Method Details
#attachments ⇒ Object
37 38 39 40 41 |
# File 'app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb', line 37 def content_tag(:ul) do safe_join(answer..map { |a| (a) }) end end |
#body ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb', line 18 def body return answer.body if answer.body.present? return if answer..any? return "-" if answer.choices.empty? choices = answer.choices.map do |choice| { answer_option_body: choice.try(:answer_option).try(:translated_body), choice_body: body_or_custom_body(choice) } end return choice(choices.first) if answer.question.question_type == "single_option" content_tag(:ul) do safe_join(choices.map { |c| choice(c) }) end end |
#question ⇒ Object
14 15 16 |
# File 'app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb', line 14 def question translated_attribute(answer.question.body) end |