Sha256: d45251fb9c885d217117d93703ce91235dd155ef606b9b1db1e5d04729b1c657
Contents?: true
Size: 1.65 KB
Versions: 8
Compression:
Stored size: 1.65 KB
Contents
# frozen_string_literal: true module Decidim module Votings module AdminLog # This class holds the logic to present a `Decidim::Votings::Voting` # 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 # MonitoringCommitteeMemberPresenter.new(action_log, view_helpers).present class MonitoringCommitteeMemberPresenter < Decidim::Log::BasePresenter private def monitoring_committee_member_user @monitoring_committee_member_user ||= action_log.resource&.user end def monitoring_committee_member_user_extra { "name" => monitoring_committee_member_user.name, "nickname" => monitoring_committee_member_user.nickname } end def monitoring_committee_member_user_presenter @monitoring_committee_member_user_presenter ||= Decidim::Log::UserPresenter.new(monitoring_committee_member_user, h, monitoring_committee_member_user_extra) end def i18n_params super.merge( monitoring_committee_member_user: monitoring_committee_member_user.present? ? monitoring_committee_member_user_presenter.present : resource_presenter.try(:present) ) end def action_string case action when "create", "delete" "decidim.votings.admin_log.monitoring_committee_member.#{action}" else super end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems