Class: Decidim::Exporters::FormPDF::QuestionnaireResponsePresenter
- Inherits:
-
Forms::Admin::QuestionnaireResponsePresenter
- Object
- SimpleDelegator
- Forms::Admin::QuestionnaireResponsePresenter
- Decidim::Exporters::FormPDF::QuestionnaireResponsePresenter
- Defined in:
- decidim-forms/lib/decidim/exporters/form_pdf.rb
Instance Method Summary collapse
Methods inherited from Forms::Admin::QuestionnaireResponsePresenter
#attachments, #question, #response, #view_context
Methods included from TranslatableAttributes
#attachment?, #default_locale?
Instance Method Details
#body ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'decidim-forms/lib/decidim/exporters/form_pdf.rb', line 20 def body return { string: response.body } if response.body.present? return { attachments: response. } if response..any? return { string: "-" } if response.choices.empty? choices = response.choices.map do |choice| { response_option_body: choice.try(:response_option).try(:translated_body), choice_body: body_or_custom_body(choice) } end return { single_option: choice(choices.first) } if response.question.question_type == "single_option" { multiple_option: choices.map { |c| choice(c) } } end |
#choice(choice_hash) ⇒ Object
14 15 16 |
# File 'decidim-forms/lib/decidim/exporters/form_pdf.rb', line 14 def choice(choice_hash) render_body_for choice_hash end |