Sha256: a340abbcb0b25bbcf102fb6ca9870dda03a27cc44ff70848d792ecb76678d3da
Contents?: true
Size: 1.29 KB
Versions: 16
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module Decidim module Plans module AdminLog # This class holds the logic to present a `Decidim::Plans::Plan` # 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 # PlanPresenter.new(action_log, view_helpers).present class PlanPresenter < Decidim::Log::BasePresenter private def resource_presenter @resource_presenter ||= Decidim::Plans::Log::ResourcePresenter.new(action_log.resource, h, action_log.extra["resource"]) end def diff_fields_mapping { state: "Decidim::Plans::AdminLog::ValueTypes::PlanStatePresenter", answered_at: :date, answer: :i18n } end def action_string case action when "answer", "create", "update" "decidim.plans.admin_log.plan.#{action}" else super end end def i18n_labels_scope "activemodel.attributes.plan" end def has_diff? action == "answer" || super end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems