Sha256: 6755e19da765cc3d9b23faee421b4afe516a5745bfa1adae9fa1709105717c0f
Contents?: true
Size: 1.27 KB
Versions: 18
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module Decidim module AdminLog # This class holds the logic to present a `Decidim::Scope` # for the `AdminLog` log. # # Usage should be automatic and you should not need to call this class # directly, but here is an example: # # action_log = Decidim::ActionLog.last # view_helpers # => this comes from the views # ScopePresenter.new(action_log, view_helpers).present class ScopePresenter < Decidim::Log::BasePresenter private def diff_fields_mapping { code: :string, name: :i18n, parent_id: :scope, scope_type_id: :scope_type } end def action_string case action when "create", "delete", "update" if parent_name.present? "decidim.admin_log.scope.#{action}_with_parent" else "decidim.admin_log.scope.#{action}" end else super end end def i18n_labels_scope "activemodel.attributes.scope" end def i18n_params super.merge( parent_scope: h.translated_attribute(parent_name) ) end def parent_name action_log.extra.dig("extra", "parent_name") end end end end
Version data entries
18 entries across 18 versions & 1 rubygems