Class: AppyantraAdmin::UsersController
Instance Method Summary
collapse
Methods included from Utils
#list_page_layouts, #random_password
#add_breadcrumb, #asset_display_name, #current_breadcrumb, #get_object_name, #set_objects
Instance Method Details
#create ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 24
def create
selected_user = User.new(params[:user])
password = random_password
selected_user.password = password
selected_user.password_confirmation = password
respond_to do |format|
if selected_user.save
format.html do |format|
flash[:notice] = "User Profile was successfully created"
redirect_to main_app.appyantra_admin_users_path
end
else
end
end
end
|
#destroy ⇒ Object
84
85
86
87
88
89
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 84
def destroy
user = User.find(params[:id])
user.destroy
flash[:notice] = "User was successfully deleted."
redirect_to main_app.appyantra_admin_users_path
end
|
#edit ⇒ Object
51
52
53
54
55
56
57
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 51
def edit
@user = User.find(params[:id])
@page_title = 'User | ' + @user.display_name
add_breadcrumb([@user.display_name, main_app.edit_appyantra_admin_user_path(@user)])
current_breadcrumb 'Edit'
render 'edit'
end
|
#index ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 12
def index
@page_title = 'User Profiles'
current_breadcrumb @page_title
@users = User.all
end
|
#new ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 18
def new
@page_title = 'New User'
current_breadcrumb 'New'
@user = User.new
end
|
#show ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 41
def show
@selected_user = User.find(params[:id])
@page_title = 'User | ' + @selected_user.display_name
current_breadcrumb @selected_user.display_name
respond_to do |format|
format.html
format.js
end
end
|
#update ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 59
def update
selected_user = User.find(params[:id])
respond_to do |format|
if selected_user.update_attributes(params[:user])
format.html do |format|
flash[:notice] = "User Profile was successfully updated."
redirect_to main_app.appyantra_admin_users_path
end
else
end
end
end
|
#update_password ⇒ Object
73
74
75
76
77
78
79
80
81
82
|
# File 'app/controllers/appyantra_admin/users_controller.rb', line 73
def update_password
user = User.find(params[:id])
password_params = params[:user]
user.reset_password!(password_params[:password], password_params[:password_confirmation])
flash[:notice] = "Password was successfully updated."
redirect_to main_app.appyantra_admin_users_path
end
|