Sha256: ac6a6d32aae18ba5f0dd4666ca71d16b3fa252bb3c8644e232568ede358c4216

Contents?: true

Size: 1.1 KB

Versions: 32

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Decidim
  module Debates
    module AdminLog
      # This class holds the logic to present a `Decidim::Debate`
      # 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
      #    DebatePresenter.new(action_log, view_helpers).present
      class DebatePresenter < Decidim::Log::BasePresenter
        private

        def diff_fields_mapping
          {
            description: :i18n,
            end_date: :date,
            information_updates: :i18n,
            instructions: :i18n,
            start_date: :date,
            title: :i18n
          }
        end

        def i18n_labels_scope
          "activemodel.attributes.debate"
        end

        def action_string
          case action
          when "create", "update"
            "decidim.debates.admin_log.debate.#{action}"
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
decidim-debates-0.22.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.21.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.20.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.20.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.19.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.18.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.19.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.17.2 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.18.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.17.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.16.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.17.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.16.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.15.2 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.15.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.15.0 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.14.4 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.14.3 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.14.2 app/presenters/decidim/debates/admin_log/debate_presenter.rb
decidim-debates-0.14.1 app/presenters/decidim/debates/admin_log/debate_presenter.rb