Sha256: 7ef8758ce312b062a8d7a8362fa02274f34dee600074e724d67736d26f8efcbf

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Decidim
  module EnhancedTextwork
    module AdminLog
      # This class holds the logic to present a `Decidim::EnhancedTextwork::ParagraphNote`
      # 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
      #    ParagraphNotePresenter.new(action_log, view_helpers).present
      class ParagraphNotePresenter < Decidim::Log::BasePresenter
        private

        def diff_fields_mapping
          {
            body: :string
          }
        end

        def action_string
          case action
          when "create"
            "decidim.enhanced_textwork.admin_log.paragraph_note.#{action}"
          else
            super
          end
        end

        def i18n_labels_scope
          "activemodel.attributes.paragraph_note"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-enhanced_textwork-1.0.5 app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb
decidim-enhanced_textwork-1.0.4 app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb
decidim-enhanced_textwork-1.0.3 app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb
decidim-enhanced_textwork-1.0.2 app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb
decidim-enhanced_textwork-1.0.1 app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb
decidim-enhanced_textwork-1.0.0 app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb