Sha256: a44c4c742c1de54658eaf0a40217f55d6b4dc0f49deef5bc867846a68ac191d2

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    # This class serializes a AdminAccountability so can be exported to CSV, JSON or other
    # formats.
    class PaperTrailVersionSerializer < Decidim::Exporters::Serializer
      include Decidim::ApplicationHelper
      include Decidim::ResourceHelper
      include Decidim::TranslationsHelper

      # Public: Initializes the serializer with a admin actions.
      def initialize(log_entry)
        @entry = log_entry.present(html: false)
      end

      # Public: Exports a hash with the serialized data for this admin action.
      def serialize
        {
          role: entry.role_name,
          user_name: entry.user_name,
          user_email: entry.user_email,
          user_role_type: entry.entry.item_type,
          participatory_space_type: entry.participatory_space_type,
          participatory_space_title: translated_attribute(entry.participatory_space&.title),
          last_sign_in_at: entry.last_sign_in_date,
          role_created_at: entry.created_date,
          role_removed_at: entry.removal_date
        }
      end

      private

      attr_reader :entry
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.10.3 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.11.2 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.11.1 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.10.2 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.10.1 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.10.0 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.9.3 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
decidim-decidim_awesome-0.9.1 app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb