Sha256: 93953c572b02b7adfd2073491c43b7c5cc9da6489e15628cb8577e0f0d82adfa

Contents?: true

Size: 1.29 KB

Versions: 25

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # This command is executed when the user exports the registrations of
      # a Conference from the admin panel.
      class ExportConferenceRegistrations < Decidim::Command
        # conference - The current instance of the page to be closed.
        # format - a string representing the export format
        # current_user - the user performing the action
        def initialize(conference, format, current_user)
          @conference = conference
          @format = format
          @current_user = current_user
        end

        # Exports the conference registrations.
        #
        # Broadcasts :ok if successful, :invalid otherwise.
        def call
          broadcast(:ok, export_data)
        end

        private

        attr_reader :current_user, :conference, :format

        def export_data
          Decidim.traceability.perform_action!(
            :export_conference_registrations,
            conference,
            current_user
          ) do
            Decidim::Exporters
              .find_exporter(format)
              .new(conference.conference_registrations, Decidim::Conferences::ConferenceRegistrationSerializer)
              .export
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.4 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.9 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.29.0 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.3 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.8 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.29.0.rc4 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.29.0.rc3 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.29.0.rc2 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.29.0.rc1 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.2 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.7 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.1 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.6 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.0 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.5 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.0.rc5 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.28.0.rc4 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.4 app/commands/decidim/conferences/admin/export_conference_registrations.rb
decidim-conferences-0.27.3 app/commands/decidim/conferences/admin/export_conference_registrations.rb