0a6345c60b
This commit implements the sort functionality for the user lists (by name, email, last_activity) and ordergroup lists (by name). It is a first attempt addressing issue #560.
20 lines
578 B
Ruby
20 lines
578 B
Ruby
class Foodcoop::OrdergroupsController < ApplicationController
|
|
def index
|
|
@ordergroups = Ordergroup.undeleted.sort_by_param(params["sort"])
|
|
|
|
unless params[:name].blank? # Search by name
|
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:name]}%")
|
|
end
|
|
|
|
if params[:only_active] # Select only active groups
|
|
@ordergroups = @ordergroups.active
|
|
end
|
|
|
|
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.erb
|
|
format.js { render :layout => false }
|
|
end
|
|
end
|
|
end
|