2009-08-02 19:01:45 +02:00
|
|
|
class Foodcoop::UsersController < ApplicationController
|
|
|
|
def index
|
2023-05-12 13:01:12 +02:00
|
|
|
@users = User.undeleted.sort_by_param(params['sort'])
|
2011-05-15 23:43:23 +02:00
|
|
|
|
|
|
|
# if somebody uses the search field:
|
2023-05-12 13:01:12 +02:00
|
|
|
@users = @users.natural_search(params[:user_name]) if params[:user_name].present?
|
2011-05-15 23:43:23 +02:00
|
|
|
|
2012-10-08 15:24:32 +02:00
|
|
|
if params[:ordergroup_name]
|
2023-05-12 13:01:12 +02:00
|
|
|
@users = @users.joins(:groups).where("groups.type = 'Ordergroup' AND groups.name LIKE ?",
|
|
|
|
"%#{params[:ordergroup_name]}%")
|
2012-10-08 15:24:32 +02:00
|
|
|
end
|
|
|
|
|
2013-09-20 23:18:06 +02:00
|
|
|
@users = @users.page(params[:page]).per(@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
|
2023-05-12 13:01:12 +02:00
|
|
|
format.js { render layout: false } # index.js.erb
|
2009-08-02 19:01:45 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|