Sha256: 776d29c3210d53c572321a52996bc7c62962498bbe7b35d1ee3bd21a42fb25e2

Contents?: true

Size: 1.42 KB

Versions: 16

Compression:

Stored size: 1.42 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/#{export_data.extension}", 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

16 entries across 16 versions & 1 rubygems

Version Path
decidim-meetings-0.10.1 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.10.0 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.9.3 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.9.2 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.9.1 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.9.0 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.8.4 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.8.3 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.8.2 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.8.1 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.8.0 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.7.4 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.7.3 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.7.2 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.7.1 app/controllers/decidim/meetings/admin/registrations_controller.rb
decidim-meetings-0.7.0 app/controllers/decidim/meetings/admin/registrations_controller.rb