Class: Decidim::Meetings::Admin::InvitesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/decidim/meetings/admin/invites_controller.rb

Overview

Controller that allows inviting users to join a meeting.

Instance Method Summary collapse

Methods inherited from ApplicationController

#meetings

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/decidim/meetings/admin/invites_controller.rb', line 17

def create
  enforce_permission_to :invite_user, :meeting, meeting: meeting

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

  InviteUserToJoinMeeting.call(@form, meeting, current_user) do
    on(:ok) do
      flash[:notice] = I18n.t("invites.create.success", scope: "decidim.meetings.admin")
      redirect_to edit_meeting_registrations_path(meeting)
    end

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

#newObject



11
12
13
14
15
# File 'app/controllers/decidim/meetings/admin/invites_controller.rb', line 11

def new
  enforce_permission_to :invite_user, :meeting, meeting: meeting

  @form = form(MeetingRegistrationInviteForm).instance
end