Sha256: 68f684f8dde1878c20229490a0b405c3b8d5dedb7138d3681a5f452582e911a2

Contents?: true

Size: 1.17 KB

Versions: 16

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

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

        def diff_fields_mapping
          {
            name: :string,
            partner_type: :string,
            link: :string,
            weight: :integer,
            logo: :string
          }
        end

        def i18n_labels_scope
          "activemodel.attributes.conferences.partner"
        end

        def action_string
          case action
          when "create", "delete", "update"
            "decidim.admin_log.conferences.partner.#{action}"
          else
            super
          end
        end

        def has_diff?
          action == "delete" || super
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
decidim-conferences-0.23.1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.23.1.rc1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.23.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.22.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.21.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.20.1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.20.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.19.1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.18.1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.19.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.17.2 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.18.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.17.1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.16.1 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.17.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb
decidim-conferences-0.16.0 app/presenters/decidim/conferences/admin_log/partner_presenter.rb