Class: Admin::UsersController
- Inherits:
-
AdminController
- Object
- AdminController
- Admin::UsersController
- Defined in:
- app/controllers/admin/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #deactivated ⇒ Object
- #delete_image ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/admin/users_controller.rb', line 30 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
57 58 59 60 61 62 63 |
# File 'app/controllers/admin/users_controller.rb', line 57 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
50 51 52 53 54 55 |
# File 'app/controllers/admin/users_controller.rb', line 50 def destroy @user = User.find(params.expect(:id)) flash[:notice] = "User <strong>#{@user.email}</strong> has been deleted" @user.destroy redirect_to admin_users_url end |
#edit ⇒ Object
28 |
# File 'app/controllers/admin/users_controller.rb', line 28 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.order(created_at: :desc) end |
#new ⇒ Object
24 25 26 |
# File 'app/controllers/admin/users_controller.rb', line 24 def new @user = User.new end |
#show ⇒ Object
22 |
# File 'app/controllers/admin/users_controller.rb', line 22 def show; end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/admin/users_controller.rb', line 40 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] = t("pages_core.problems_saving") render action: :edit end end |