Class: AppyantraAdmin::ProfilesController
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 25
def create
selected_admin_user = Admin.new(params[:admin_user])
password = random_password
selected_admin_user.password = password
selected_admin_user.password_confirmation = password
respond_to do |format|
if selected_admin_user.save
format.html do |format|
flash[:notice] = "Admin user was successfully created"
redirect_to main_app.admin_profiles_path
end
else
end
end
end
|
#destroy ⇒ Object
86
87
88
89
90
91
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 86
def destroy
admin_user = Admin.find(params[:id])
admin_user.destroy
flash[:notice] = "Admin was successfully deleted."
redirect_to main_app.admin_profiles_path
end
|
#edit ⇒ Object
53
54
55
56
57
58
59
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 53
def edit
@admin_user = Admin.find(params[:id])
@page_title = 'Admin User | ' + @admin_user.display_name
add_breadcrumb([@admin_user.display_name, main_app.admin_profile_path(@admin_user)])
current_breadcrumb 'Edit'
render 'edit'
end
|
#index ⇒ Object
12
13
14
15
16
17
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 12
def index
@page_title = 'Admin Profiles'
current_breadcrumb @page_title
@admin_users = Admin.all
render 'index'
end
|
#new ⇒ Object
19
20
21
22
23
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 19
def new
@page_title = 'New Admin User'
current_breadcrumb 'New'
@admin_user = Admin.new
end
|
#show ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 43
def show
@selected_admin_user = Admin.find(params[:id])
@page_title = 'Admin User | ' + @selected_admin_user.display_name
current_breadcrumb @selected_admin_user.display_name
respond_to do |format|
format.html
format.js
end
end
|
#update ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 61
def update
selected_admin_user = Admin.find(params[:id])
respond_to do |format|
if selected_admin_user.update_attributes(params[:admin_user])
format.html do |format|
flash[:notice] = "Profile was successfully updated."
redirect_to main_app.admin_profiles_path
end
else
end
end
end
|
#update_password ⇒ Object
75
76
77
78
79
80
81
82
83
84
|
# File 'app/controllers/appyantra_admin/profiles_controller.rb', line 75
def update_password
admin_user = Admin.find(params[:id])
password_params = params[:admin_user]
admin_user.reset_password!(password_params[:password], password_params[:password_confirmation])
sign_in(current_admin, :bypass => true)
flash[:notice] = "Password was successfully updated."
redirect_to main_app.admin_profiles_path
end
|