Class: Decidim::Conferences::Admin::ConferenceRegistrationsController

Inherits:
ApplicationController show all
Includes:
Decidim::Conferences::Admin::Concerns::ConferenceAdmin, Paginable
Defined in:
decidim-conferences/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb

Overview

Controller that allows to manage the conference users registrations.

Constant Summary

Constants included from Paginable

Paginable::OPTIONS

Instance Method Summary collapse

Methods inherited from Admin::ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#confirmObject


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'decidim-conferences/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb', line 30

def confirm
  enforce_permission_to :confirm, :conference_registration, conference_registration: conference_registration

  ConfirmConferenceRegistration.call(conference_registration, current_user) do
    on(:ok) do
      flash[:notice] = I18n.t("conference_registration.confirm.success", scope: "decidim.admin")
    end

    on(:invalid) do
      flash[:alert] = I18n.t("conference_registration.confirm.error", scope: "decidim.admin")
    end

    redirect_back(fallback_location: conference_conference_registrations_path)
  end
end

#exportObject


20
21
22
23
24
25
26
27
28
# File 'decidim-conferences/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb', line 20

def export
  enforce_permission_to :export_conference_registrations, :conference, conference: conference

  ExportConferenceRegistrations.call(conference, params[:format], current_user) do
    on(:ok) do |export_data|
      send_data export_data.read, type: "text/#{export_data.extension}", filename: export_data.filename("conference_registrations")
    end
  end
end

#indexObject


14
15
16
17
18
# File 'decidim-conferences/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb', line 14

def index
  enforce_permission_to :read_conference_registrations, :conference, conference: conference

  @conference_registrations = paginate(Decidim::Conferences::ConferenceRegistration.where(conference: conference))
end