Sha256: 1ccd014f47448a9eef41bc7d64aaa41f113e16e522d615b85ac5798132cf1ad9
Contents?: true
Size: 1.49 KB
Versions: 35
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses module AdminLog # This class holds the logic to present a `Decidim::ParticipatoryProcessUserRole` # 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 # ParticipatoryProcessUserRolePresenter.new(action_log, view_helpers).present class ParticipatoryProcessUserRolePresenter < Decidim::Log::BasePresenter private def diff_fields_mapping { role: "Decidim::ParticipatoryProcesses::AdminLog::ValueTypes::RolePresenter" } end def changeset return super unless action.to_s == "delete" Decidim::Log::DiffChangesetCalculator.new( { role: [action_log.version.object["role"], ""] }, diff_fields_mapping, i18n_labels_scope ).changeset end def has_diff? action == "delete" || super end def action_string case action when "create", "update", "delete" "decidim.admin_log.participatory_process_user_role.#{action}" else super end end def i18n_labels_scope "activemodel.attributes.participatory_process_user_role" end end end end end
Version data entries
35 entries across 35 versions & 1 rubygems