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

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

Overview

Controller that allows inviting users to join a conference.

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



19
20
21
22
23
# File 'app/controllers/decidim/conferences/admin/conference_invites_controller.rb', line 19

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

  @conference_invites = filtered_collection
end

#newObject



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

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

  @form = form(ConferenceRegistrationInviteForm).instance
end