Sha256: 806cd72af7b5e1f7eb2c6da878c81e933a76f00c7d8a201659f01769e6a6952f

Contents?: true

Size: 1.54 KB

Versions: 24

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

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

        def diff_fields_mapping
          {
            description: :i18n,
            developer_group: :i18n,
            hashtag: :string,
            local_area: :i18n,
            meta_scope: :i18n,
            participatory_scope: :i18n,
            participatory_structure: :i18n,
            published_at: :date,
            scopes_enabled: :boolean,
            short_description: :i18n,
            slug: :string,
            subtitle: :i18n,
            target: :i18n,
            title: :i18n
          }
        end

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

        def i18n_labels_scope
          "activemodel.attributes.participatory_process"
        end

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.17.2 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.17.1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.16.1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.17.0 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.16.0 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.15.2 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.15.1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.15.0 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.14.4 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.14.3 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.14.2 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.14.1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.13.1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.12.2 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.13.0 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.12.1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.13.0.pre1 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.12.0 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.11.2 app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
decidim-participatory_processes-0.12.0.pre app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb