Class: Decidim::Assemblies::AssemblySerializer
- Inherits:
-
Exporters::Serializer
- Object
- Exporters::Serializer
- Decidim::Assemblies::AssemblySerializer
- Defined in:
- decidim-assemblies/app/serializers/decidim/assemblies/assembly_serializer.rb
Overview
This class serializes an Assembly so it can be exported to CSV, JSON or other formats.
Constant Summary
Constants included from Decidim::AmendmentsHelper
Decidim::AmendmentsHelper::TOTAL_STEPS
Instance Method Summary collapse
-
#initialize(assembly) ⇒ AssemblySerializer
constructor
Public: Initializes the serializer with an Assembly instance.
-
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this assembly.
Methods included from TranslationsHelper
empty_translatable, ensure_translatable, multi_translation, translated_in_current_locale?
Methods included from TranslatableAttributes
Methods included from ResourceHelper
#linked_classes_filter_values_for, #linked_classes_for, #resource_locator, #resource_title
Methods included from Decidim::ApplicationHelper
#cell, #edit_link, #extra_admin_link, #html_truncate, #present, #prevent_timeout_seconds, #resolve_presenter_class, #step_cta_url
Methods included from CacheHelper
Methods included from Decidim::AmendmentsHelper
#accept_and_reject_buttons_for, #action_button_card_for, #allowed_to_accept_and_reject?, #allowed_to_promote?, #amend_button_for, #amendments_enabled?, #amendments_form_field_for, #amendments_form_fields_label, #amendments_form_fields_value, #can_participate_in_private_space?, #can_react_to_emendation?, #current_step, #emendation_actions_for, #emendation_announcement_for, #promote_button_for, #render_emendation_body, #total_steps, #wizard_aside_back_url, #wizard_header_title
Methods included from RichTextEditorHelper
Methods included from ContextualHelpHelper
Methods included from ScopesHelper
#has_visible_scopes?, #scope_name_for_picker, #scopes_picker_field, #scopes_picker_filter, #scopes_select_field, #scopes_select_tag
Methods included from DecidimFormHelper
#areas_for_select, #base_error_messages, #decidim_form_for, #decidim_form_slug_url, #editor_field_tag, #form_field_has_error?, #form_required_explanation, #name_with_locale, #ordered_scopes_descendants, #ordered_scopes_descendants_for_select, #scopes_picker_field_tag, #tab_element_class_for, #translated_field_tag
Methods included from OmniauthHelper
#normalize_provider_name, #oauth_icon, #provider_name
Methods inherited from Exporters::Serializer
Constructor Details
#initialize(assembly) ⇒ AssemblySerializer
Public: Initializes the serializer with an Assembly instance.
12 13 14 |
# File 'decidim-assemblies/app/serializers/decidim/assemblies/assembly_serializer.rb', line 12 def initialize(assembly) @assembly = assembly end |
Instance Method Details
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this assembly.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'decidim-assemblies/app/serializers/decidim/assemblies/assembly_serializer.rb', line 17 def serialize { id: assembly.id, slug: assembly.slug, hashtag: assembly.hashtag, decidim_organization_id: assembly.decidim_organization_id, title: assembly.title, subtitle: assembly.subtitle, weight: assembly.weight, short_description: assembly.short_description, description: assembly.description, remote_hero_image_url: Decidim::Assemblies::AssemblyPresenter.new(assembly).hero_image_url, remote_banner_image_url: Decidim::Assemblies::AssemblyPresenter.new(assembly)., promoted: assembly.promoted, developer_group: assembly.developer_group, meta_scope: assembly., local_area: assembly.local_area, target: assembly.target, decidim_scope_id: assembly.decidim_scope_id, paticipatory_scope: assembly.participatory_scope, participatory_structure: assembly.participatory_structure, show_statistics: assembly.show_statistics, scopes_enabled: assembly.scopes_enabled, private_space: assembly.private_space, reference: assembly.reference, purpose_of_action: assembly.purpose_of_action, composition: assembly.composition, duration: assembly.duration, participatory_scope: assembly.participatory_scope, included_at: assembly.included_at, closing_date: assembly.closing_date, created_by: assembly.created_by, creation_date: assembly.creation_date, closing_date_reason: assembly.closing_date_reason, internal_organisation: assembly.internal_organisation, is_transparent: assembly.is_transparent, special_features: assembly.special_features, twitter_handler: assembly.twitter_handler, instagram_handler: assembly.instagram_handler, facebook_handler: assembly.facebook_handler, youtube_handler: assembly.youtube_handler, github_handler: assembly.github_handler, created_by_other: assembly.created_by_other, decidim_assemblies_type_id: assembly.decidim_assemblies_type_id, area: { id: assembly.area.try(:id), name: assembly.area.try(:name) || empty_translatable }, scope: { id: assembly.scope.try(:id), name: assembly.scope.try(:name) || empty_translatable }, assembly_categories: serialize_categories, attachments: { attachment_collections: , files: }, components: serialize_components, announcement: assembly.announcement } end |