Class: Decidim::DecidimAwesome::PaperTrailVersionSerializer
- Inherits:
-
Exporters::Serializer
- Object
- Exporters::Serializer
- Decidim::DecidimAwesome::PaperTrailVersionSerializer
- Includes:
- ApplicationHelper, ResourceHelper, TranslationsHelper
- Defined in:
- app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
Overview
This class serializes a AdminAccountability so can be exported to CSV, JSON or other formats.
Instance Method Summary collapse
-
#initialize(log_entry) ⇒ PaperTrailVersionSerializer
constructor
Public: Initializes the serializer with a admin actions.
-
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this admin action.
Constructor Details
#initialize(log_entry) ⇒ PaperTrailVersionSerializer
Public: Initializes the serializer with a admin actions.
13 14 15 |
# File 'app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb', line 13 def initialize(log_entry) @entry = log_entry.present(html: false) end |
Instance Method Details
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this admin action.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb', line 18 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 |