2009-08-02 19:01:45 +02:00
|
|
|
class Foodcoop::UsersController < ApplicationController
|
|
|
|
|
|
|
|
def index
|
2011-05-15 23:43:23 +02:00
|
|
|
@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)
|
2009-08-02 19:01:45 +02:00
|
|
|
|
2011-05-15 23:43:23 +02:00
|
|
|
respond_to do |format|
|
|
|
|
format.html # index.html.haml
|
|
|
|
format.js { render :layout => false } # index.js.erb
|
2009-08-02 19:01:45 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|