Sha256: 337b59e0cb0276e5725b371ee0d87270f4891700354d0c5f8cc1307e2bef04a1

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module AdminLog
      # This class holds the logic to present a `Decidim::Meetings::Questionnaire`
      # for the `AdminLog` log.
      #
      # Usage should be automatic and you shouldn't need to call this class
      # directly, but here's an example:
      #
      #    action_log = Decidim::ActionLog.last
      #    view_helpers # => this comes from the views
      #    QuestionnairePresenter.new(action_log, view_helpers).present
      class QuestionnairePresenter < Decidim::Log::BasePresenter
        private

        def action_string
          case action
          when "update"
            "decidim.meetings.admin_log.questionnaire.#{action}"
          else
            super
          end
        end

        def resource_presenter
          @resource_presenter ||= Decidim::Log::ResourcePresenter.new(action_log.resource.questionnaire_for.meeting, h, action_log.resource.questionnaire_for.meeting)
        end

        def i18n_params
          super.merge(
            meeting_name: resource_presenter.try(:present)
          )
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.8 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.7 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.6 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.5 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.4 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.3 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.2 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.1 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.0 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.0.rc2 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb
decidim-meetings-0.27.0.rc1 app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb