Class: Decidim::Conferences::Admin::ConferenceInvitesController

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

Overview

Controller that allows inviting users to join a conference.

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 Headers::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

#createObject



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

def create
  enforce_permission_to(:invite_attendee, :conference, conference: current_participatory_space)

  @form = form(ConferenceRegistrationInviteForm).from_params(params)

  InviteUserToJoinConference.call(@form, current_participatory_space, current_user) do
    on(:ok) do
      flash[:notice] = I18n.t("conference_invites.create.success", scope: "decidim.conferences.admin")
      redirect_to conference_conference_invites_path(current_participatory_space)
    end

    on(:invalid) do
      flash.now[:alert] = I18n.t("conference_invites.create.error", scope: "decidim.conferences.admin")
      render :new
    end
  end
end

#indexObject



16
17
18
19
20
21
22
# File 'decidim-conferences/app/controllers/decidim/conferences/admin/conference_invites_controller.rb', line 16

def index
  enforce_permission_to(:read_invites, :conference, conference: current_participatory_space)

  @query = params[:q]
  @status = params[:status]
  @conference_invites = Decidim::Admin::Invites.for(current_participatory_space.conference_invites, @query, @status).page(params[:page]).per(15)
end

#newObject



24
25
26
27
28
# File 'decidim-conferences/app/controllers/decidim/conferences/admin/conference_invites_controller.rb', line 24

def new
  enforce_permission_to(:invite_attendee, :conference, conference: current_participatory_space)

  @form = form(ConferenceRegistrationInviteForm).instance
end