19 lines
596 B
Ruby
19 lines
596 B
Ruby
class Admin::UsersController < Admin::BaseController
|
|
inherit_resources
|
|
|
|
def index
|
|
@users = User.order(:nick.asc)
|
|
|
|
# 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)
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.haml
|
|
format.js { render :layout => false } # index.js.erb
|
|
end
|
|
end
|
|
end
|