Class: Decidim::ActionDelegator::Admin::InviteParticipantsController

Inherits:
ApplicationController
  • Object
show all
Includes:
NeedsPermission
Defined in:
app/controllers/decidim/action_delegator/admin/invite_participants_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain

Instance Method Details

#invite_all_usersObject



24
25
26
27
28
29
30
31
# File 'app/controllers/decidim/action_delegator/admin/invite_participants_controller.rb', line 24

def invite_all_users
  enforce_permission_to :invite, :participant, resource: current_setting

  InviteParticipantsJob.perform_later(current_setting, current_organization)

  notice = t("invite_all_users.success", scope: "decidim.action_delegator.admin.invite_participants")
  redirect_to decidim_admin_action_delegator.setting_participants_path(current_setting), notice: notice
end

#invite_userObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/decidim/action_delegator/admin/invite_participants_controller.rb', line 13

def invite_user
  enforce_permission_to :invite, :participant, resource: current_setting

  Decidim::InviteUser.call(form) do
    on(:ok) do
      notice = t("invite_user.success", scope: "decidim.action_delegator.admin.invite_participants")
      redirect_to decidim_admin_action_delegator.setting_participants_path(current_setting), notice: notice
    end
  end
end

#resend_invitationObject



33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/decidim/action_delegator/admin/invite_participants_controller.rb', line 33

def resend_invitation
  enforce_permission_to :invite, :participant, resource: current_setting

  Decidim::InviteUserAgain.call(participant.user, "invitation_instructions") do
    on(:ok) do
      flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
    end

    redirect_to setting_participants_path(current_setting)
  end
end