Sha256: ee0ce446995ea99db2264895bad040552172c580f4c9503205067af223bbdc09
Contents?: true
Size: 1.47 KB
Versions: 24
Compression:
Stored size: 1.47 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 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 # PollingOfficerPresenter.new(action_log, view_helpers).present class PollingOfficerPresenter < Decidim::Log::BasePresenter private def polling_officer_user @polling_officer_user ||= action_log.resource&.user end def polling_officer_user_extra { "name" => polling_officer_user.name, "nickname" => polling_officer_user.nickname } end def polling_officer_user_presenter @polling_officer_user_presenter ||= Decidim::Log::UserPresenter.new(polling_officer_user, h, polling_officer_user_extra) end def i18n_params super.merge( polling_officer_user: polling_officer_user.present? ? polling_officer_user_presenter.present : resource_presenter.try(:present) ) end def action_string case action when "create", "delete" "decidim.votings.admin_log.polling_officer.#{action}" else super end end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems