Class: Decidim::Conferences::ConferenceRegistrationsController

Inherits:
ApplicationController show all
Defined in:
decidim-conferences/app/controllers/decidim/conferences/conference_registrations_controller.rb

Overview

Exposes the registration resource so users can join and leave conferences.

Instance Method Summary collapse

Methods included from RegistersPermissions

register_permissions

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#createObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'decidim-conferences/app/controllers/decidim/conferences/conference_registrations_controller.rb', line 7

def create
  enforce_permission_to :join, :conference, conference: conference

  JoinConference.call(conference, registration_type, current_user) do
    on(:ok) do
      flash[:notice] = I18n.t("conference_registrations.create.success", scope: "decidim.conferences")
      redirect_after_path
    end

    on(:invalid) do
      flash.now[:alert] = I18n.t("conference_registrations.create.invalid", scope: "decidim.conferences")
      redirect_after_path
    end
  end
end

#decline_invitationObject


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'decidim-conferences/app/controllers/decidim/conferences/conference_registrations_controller.rb', line 39

def decline_invitation
  enforce_permission_to :decline_invitation, :conference, conference: conference

  DeclineInvitation.call(conference, current_user) do
    on(:ok) do
      flash[:notice] = I18n.t("conference_registrations.decline_invitation.success", scope: "decidim.conferences")
      redirect_after_path
    end

    on(:invalid) do
      flash.now[:alert] = I18n.t("conference_registrations.decline_invitation.invalid", scope: "decidim.conferences")
      redirect_after_path
    end
  end
end

#destroyObject


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'decidim-conferences/app/controllers/decidim/conferences/conference_registrations_controller.rb', line 23

def destroy
  enforce_permission_to :leave, :conference, conference: conference

  LeaveConference.call(conference, registration_type, current_user) do
    on(:ok) do
      flash[:notice] = I18n.t("conference_registrations.destroy.success", scope: "decidim.conferences")
      redirect_after_path
    end

    on(:invalid) do
      flash.now[:alert] = I18n.t("conference_registrations.destroy.invalid", scope: "decidim.conferences")
      redirect_after_path
    end
  end
end