Sha256: 3bfb020899551f1ca719b240c36da7e4060d0d17e3946b35dc44af37e3de0350

Contents?: true

Size: 1.4 KB

Versions: 18

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Admin
      # This controller allows an admin to manage meeting registrations from a Participatory Process
      class RegistrationsController < Admin::ApplicationController
        def edit
          @form = MeetingRegistrationsForm.from_model(meeting)
        end

        def update
          @form = MeetingRegistrationsForm.from_params(params).with_context(current_organization: meeting.organization, meeting: meeting)

          UpdateRegistrations.call(@form, meeting) do
            on(:ok) do
              flash[:notice] = I18n.t("registrations.update.success", scope: "decidim.meetings.admin")
              redirect_to meetings_path
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("registrations.update.invalid", scope: "decidim.meetings.admin")
              render action: "edit"
            end
          end
        end

        def export
          format = params[:format]
          export_data = Decidim::Exporters.find_exporter(format).new(meeting.registrations, Decidim::Meetings::RegistrationSerializer).export

          send_data export_data.read, type: "text/#{format}", filename: export_data.filename("registrations")
        end

        private

        def meeting
          @meeting ||= Meeting.where(feature: current_feature).find(params[:meeting_id])
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
decidim-meetings-0.6.8 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.8 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.7 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.7 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.6 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.6 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.5 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.5 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.4 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.4 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.3 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.3 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.2 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.2 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.1 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.1 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.6.0 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-0.6.0 decidim-meetings/app/controllers/decidim/meetings/admin/registrations_controller.rb