Class: Manage::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/manage/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#activateObject

POST /manage/users/1/activate



36
37
38
39
# File 'app/controllers/manage/users_controller.rb', line 36

def activate
  @user.confirm!    
  respond_with(@user, :location => manage_users_path)
end

#createObject



22
23
24
25
# File 'app/controllers/manage/users_controller.rb', line 22

def create
  @user.attributes = params[:user]
  create! { manage_users_path } 
end

#destroyObject



31
32
33
# File 'app/controllers/manage/users_controller.rb', line 31

def destroy
  destroy!{ manage_users_path }
end

#indexObject



12
13
14
15
16
17
18
19
20
# File 'app/controllers/manage/users_controller.rb', line 12

def index
  index! do |format|
    format.csv { send_data(User.to_csv, :filename => "users_#{Date.today}.csv", :type => "text/csv") }
    format.json do
      @users = User.with_email(params[:term]).includes(:avatar).select("users.id, users.name, users.email").limit(50)
      render :json => @users.as_json(:methods => [:avatar_small_url])
    end
  end
end

#suspendObject

POST /manage/users/1/suspend



42
43
44
45
# File 'app/controllers/manage/users_controller.rb', line 42

def suspend
  @user.suspend! 
  respond_with(@user, :location => manage_users_path)
end

#unlockObject

POST /manage/users/1/unlock



54
55
56
57
# File 'app/controllers/manage/users_controller.rb', line 54

def unlock
  @user.unlock_access!
  respond_with(@user, :location => manage_users_path)
end

#unsuspendObject

POST /manage/users/1/unsuspend



48
49
50
51
# File 'app/controllers/manage/users_controller.rb', line 48

def unsuspend
  @user.unsuspend!
  respond_with(@user, :location => manage_users_path)
end

#updateObject



27
28
29
# File 'app/controllers/manage/users_controller.rb', line 27

def update
  update!{ manage_users_path }
end