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

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

Overview

Controller that allows inviting users to join a conference.

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

#createObject


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

def create
  enforce_permission_to :invite_attendee, :conference, conference: conference

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

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

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

#indexObject


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

def index
  enforce_permission_to :read_invites, :conference, conference: conference

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

#newObject


21
22
23
24
25
# File 'decidim-conferences/app/controllers/decidim/conferences/admin/conference_invites_controller.rb', line 21

def new
  enforce_permission_to :invite_attendee, :conference, conference: conference

  @form = form(ConferenceRegistrationInviteForm).instance
end