Class: Virgo::Admin::UsersController
Instance Method Summary
collapse
#authorize_admin_user, #search, #set_is_admin_view
#render_content, #with_format
#action?, #admin?, #admin_access?, #admin_view?, #alerts, #base_errors, #category_timestamp, #column_timestamp, #compact_html, #controller?, #decode_html_entities, #expanded_post_url, #is_admin_view?, #page_url, #post_time_format, #post_timestamp, #production?, #redis_timestamp_key_for, #site, #site_key, #superuser?, #tabbed_param, #word_count
Instance Method Details
#create ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/virgo/admin/users_controller.rb', line 18
def create
@user = User.new(user_params)
if @user.save
flash[:notice] = "Account created successfully"
redirect_to admin_users_path
else
render :new
end
end
|
#destroy ⇒ Object
47
48
49
50
51
52
53
|
# File 'app/controllers/virgo/admin/users_controller.rb', line 47
def destroy
@user.destroy
flash[:notice] = "User successfully deleted"
redirect_to admin_users_path
end
|
#edit ⇒ Object
29
30
|
# File 'app/controllers/virgo/admin/users_controller.rb', line 29
def edit
end
|
#index ⇒ Object
9
10
11
12
|
# File 'app/controllers/virgo/admin/users_controller.rb', line 9
def index
authorize! :index, User
@users = User.search(filter_params).with_post_count.order(sort_order).page(params[:page])
end
|
#new ⇒ Object
14
15
16
|
# File 'app/controllers/virgo/admin/users_controller.rb', line 14
def new
@user = User.new
end
|
#update ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/virgo/admin/users_controller.rb', line 32
def update
_is_user = current_user == @user
if @user.update(user_params)
flash[:notice] = "Profile updated successfully"
redirect_to edit_admin_user_path(@user)
sign_in @user, bypass: true if _is_user
else
render :edit
end
end
|