Class: Decidim::Forms::Admin::QuestionnaireResponsePresenter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb

Overview

Presenter for questionnaire response

Instance Method Summary collapse

Instance Method Details

#bodyObject



26
27
28
29
30
31
32
33
34
# File 'app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb', line 26

def body
  return response.body if response.body.present?
  return attachments if response.attachments.any?
  return "-" if response.choices.empty?

  choices = build_choices

  render_choices_list(choices)
end

#questionObject



22
23
24
# File 'app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb', line 22

def question
  translated_attribute(response.question.body)
end

#responseObject



14
15
16
# File 'app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb', line 14

def response
  __getobj__.fetch(:response)
end

#view_contextObject



18
19
20
# File 'app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb', line 18

def view_context
  __getobj__.fetch(:view_context, ActionController::Base.new.view_context)
end