Sha256: b46ce8eac2d486b77c26439fa054c4edf4bbd313b861665b65c4278b8b30b523
Contents?: true
Size: 1.21 KB
Versions: 12
Compression:
Stored size: 1.21 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 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 # ProposalPresenter.new(action_log, view_helpers).present class ProposalPresenter < Decidim::Log::BasePresenter private def diff_fields_mapping { title: :string, body: :string, state: "Decidim::Proposals::AdminLog::ValueTypes::ProposalStatePresenter", answered_at: :date, answer: :i18n } end def action_string case action when "answer", "create" "decidim.proposals.admin_log.proposal.#{action}" else super end end def i18n_labels_scope "activemodel.attributes.proposal" end def has_diff? action == "answer" || super end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems