Sha256: 4d62851492156a3b589383af13fc49810db2cfe4fc933b8c9b324c5a6dde0aa7

Contents?: true

Size: 826 Bytes

Versions: 55

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Forms
    module Admin
      # Custom helpers for questionnaire answers
      #
      module QuestionnaireAnswersHelper
        def first_table_th(answer)
          if answer.first_short_answer
            @first_short_answer = answer.first_short_answer
            return translated_attribute @first_short_answer.question.body
          end

          t("session_token", scope: "decidim.forms.user_answers_serializer")
        end

        def first_table_td(answer)
          return answer.first_short_answer&.body if @first_short_answer

          answer.session_token
        end

        def display_percentage(number)
          number_to_percentage(number, precision: 0, strip_insignificant_zeros: true, locale: I18n.locale)
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
decidim-forms-0.29.1 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.4 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.27.9 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.29.0 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.3 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.27.8 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.29.0.rc4 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.29.0.rc3 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.29.0.rc2 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.29.0.rc1 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.2 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.27.7 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.1 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.27.6 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.26.10 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.26.9 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.0 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.27.5 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.0.rc5 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb
decidim-forms-0.28.0.rc4 app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb