Sha256: 5225e27b689a917788c20762240a7a72ccab3d5374faa0c9d5366adf9f1e3df9
Contents?: true
Size: 1.53 KB
Versions: 4
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true module Decidim module Proposals module AdminLog # This class holds the logic to present a `Decidim::Proposals::Proposal` # 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 # ProposalPresenter.new(action_log, view_helpers).present class ProposalPresenter < Decidim::Log::BasePresenter private def resource_presenter @resource_presenter ||= Decidim::Proposals::Log::ResourcePresenter.new(action_log.resource, h, action_log.extra["resource"]) end def diff_fields_mapping { title: "Decidim::Proposals::AdminLog::ValueTypes::ProposalTitleBodyPresenter", body: "Decidim::Proposals::AdminLog::ValueTypes::ProposalTitleBodyPresenter", state: "Decidim::Proposals::AdminLog::ValueTypes::ProposalStatePresenter", answered_at: :date, answer: :i18n } end def action_string case action when "answer", "create", "update", "publish_answer" "decidim.proposals.admin_log.proposal.#{action}" else super end end def i18n_labels_scope "activemodel.attributes.proposal" end def diff_actions super + %w(answer) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems