2010-03-22 01:58:37 +01:00
|
|
|
class Admin::UsersController < Admin::BaseController
|
2011-06-09 22:03:27 +02:00
|
|
|
inherit_resources
|
|
|
|
|
2009-01-12 18:26:09 +01:00
|
|
|
def index
|
2012-09-30 21:15:55 +02:00
|
|
|
@users = User.order('nick ASC')
|
2011-06-09 22:03:27 +02:00
|
|
|
|
|
|
|
# if somebody uses the search field:
|
|
|
|
unless params[:query].blank?
|
|
|
|
@users = @users.where(({:first_name.matches => "%#{params[:query]}%"}) | ({:last_name.matches => "%#{params[:query]}%"}) | ({:nick.matches => "%#{params[:query]}%"}))
|
|
|
|
end
|
|
|
|
|
|
|
|
@users = @users.paginate(:page => params[:page], :per_page => @per_page)
|
2009-01-12 18:26:09 +01:00
|
|
|
|
|
|
|
respond_to do |format|
|
2011-06-09 22:03:27 +02:00
|
|
|
format.html # index.html.haml
|
|
|
|
format.js { render :layout => false } # index.js.erb
|
2009-01-12 18:26:09 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|