Class: Admin::UsersController
Instance Attribute Summary
#current_user
Instance Method Summary
collapse
#redirect, underscore
#disable_static_cache!
#policy, #verify_policy, #verify_policy_with_proc
inc_number_of_requests, original_title
#render_error
#authenticate!, #deauthenticate!, #logged_in?
Instance Method Details
#create ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/admin/users_controller.rb', line 32
def create
@user = PagesCore::CreateUserService.call(user_params)
if @user.valid?
authenticate!(@user)
redirect_to admin_default_url
else
render action: :new
end
end
|
#deactivated ⇒ Object
17
18
19
20
|
# File 'app/controllers/admin/users_controller.rb', line 17
def deactivated
@users = User.deactivated
@invites = []
end
|
#delete_image ⇒ Object
63
64
65
66
67
68
69
|
# File 'app/controllers/admin/users_controller.rb', line 63
def delete_image
@user.image.destroy
respond_to do |format|
format.js { render text: "The profile picture has been deleted." }
format.html { redirect_to(edit_admin_user_url(@user)) }
end
end
|
#destroy ⇒ Object
56
57
58
59
60
61
|
# File 'app/controllers/admin/users_controller.rb', line 56
def destroy
@user = User.find(params[:id])
flash[:notice] = "User <strong>#{@user.email}</strong> has been deleted"
@user.destroy
redirect_to admin_users_url
end
|
#edit ⇒ Object
44
|
# File 'app/controllers/admin/users_controller.rb', line 44
def edit; end
|
#index ⇒ Object
12
13
14
15
|
# File 'app/controllers/admin/users_controller.rb', line 12
def index
@users = User.activated
@invites = Invite.all.order("created_at DESC")
end
|
#login ⇒ Object
22
23
24
25
26
|
# File 'app/controllers/admin/users_controller.rb', line 22
def login
return unless logged_in?
redirect_to admin_default_url
end
|
#new ⇒ Object
28
29
30
|
# File 'app/controllers/admin/users_controller.rb', line 28
def new
@user = User.new
end
|
#show ⇒ Object
42
|
# File 'app/controllers/admin/users_controller.rb', line 42
def show; end
|
#update ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'app/controllers/admin/users_controller.rb', line 46
def update
if @user.update(user_params_with_roles)
flash[:notice] = "Your changed to #{@user.name} were saved."
redirect_to admin_users_url
else
flash.now[:error] = "There were problems saving your changes."
render action: :edit
end
end
|