Sha256: 27cebcaf950a7288dac9e36192251b950f38fcf3a043abf175ce907c2cbdd22f

Contents?: true

Size: 1.51 KB

Versions: 16

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

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

        def diff_fields_mapping
          {
            description: :i18n,
            hashtag: :string,
            promoted: :boolean,
            published_at: :date,
            reference: :string,
            short_description: :i18n,
            objectives: :i18n,
            show_statistics: :boolean,
            slug: :default,
            subtitle: :i18n,
            title: :i18n,
            start_date: :date,
            end_date: :date,
            sign_date: :date,
            signature_name: :string
          }
        end

        def i18n_labels_scope
          "activemodel.attributes.conference"
        end

        def action_string
          case action
          when "create", "publish", "unpublish", "update", "update_diploma"
            "decidim.admin_log.conference.#{action}"
          else
            super
          end
        end

        def has_diff?
          action == "unpublish" || 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/conferences_presenter.rb
decidim-conferences-0.23.1.rc1 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.23.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.22.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.21.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.20.1 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.20.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.19.1 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.18.1 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.19.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.17.2 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.18.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.17.1 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.16.1 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.17.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb
decidim-conferences-0.16.0 app/presenters/decidim/conferences/admin_log/conferences_presenter.rb