Sha256: cf33b543b2161a56c56ca31ff088a613578f084ae3152e1ea259c088156e4ca7
Contents?: true
Size: 977 Bytes
Versions: 8
Compression:
Stored size: 977 Bytes
Contents
# frozen_string_literal: true module Decidim module Forms module Admin # # Presenter for questionnaire answer # class QuestionnaireAnswerPresenter < Rectify::Presenter include Decidim::TranslatableAttributes attribute :answer, Decidim::Forms::Answer def question translated_attribute(answer.question.body) end def body return answer.body if answer.body.present? return "-" if answer.choices.empty? choices = answer.choices.map do |choice| choice.try(:custom_body) || choice.try(:body) end return choices.first if answer.question.question_type == "single_option" content_tag(:ul) do safe_join(choices.map { |c| choice(c) }) end end private def choice(choice_body) content_tag :li do choice_body end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems