Class: Admin::InvitesController
Instance Attribute Summary
#current_user
Instance Method Summary
collapse
#redirect, underscore
#disable_static_cache!, #static_cached?
#policy, #verify_policy, #verify_policy_with_proc
inc_number_of_requests, original_title
#content_locale
#render_error
#authenticate!, #deauthenticate!, #logged_in?
Instance Method Details
#accept ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/admin/invites_controller.rb', line 15
def accept
@user = PagesCore::CreateUserService.call(user_params, invite: @invite)
if @user.valid?
authenticate!(@user)
redirect_to admin_default_url
else
render action: :show
end
end
|
#create ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/admin/invites_controller.rb', line 36
def create
@invite = PagesCore::InviteService.call(invite_params,
user: current_user,
host: request.host,
protocol: request.protocol)
if @invite.valid?
redirect_to admin_invites_url
else
render action: :new
end
end
|
#destroy ⇒ Object
48
49
50
51
52
|
# File 'app/controllers/admin/invites_controller.rb', line 48
def destroy
flash[:notice] = "The invite to #{@invite.email} has been deleted"
PagesCore::DestroyInviteService.call(invite: @invite)
redirect_to admin_invites_url
end
|
#index ⇒ Object
11
12
13
|
# File 'app/controllers/admin/invites_controller.rb', line 11
def index
redirect_to admin_users_url
end
|
#new ⇒ Object
29
30
31
32
33
34
|
# File 'app/controllers/admin/invites_controller.rb', line 29
def new
@invite = current_user.invites.new
Role.roles.each do |role|
@invite.roles.new(name: role.name) if role.default
end
end
|
#show ⇒ Object
25
26
27
|
# File 'app/controllers/admin/invites_controller.rb', line 25
def show
@user = User.new(email: @invite.email)
end
|