2009-08-02 18:12:13 +02:00
|
|
|
class Foodcoop::OrdergroupsController < ApplicationController
|
|
|
|
def index
|
2016-02-17 23:58:53 +01:00
|
|
|
@ordergroups = Ordergroup.undeleted.order('name')
|
2009-08-02 18:12:13 +02:00
|
|
|
|
2012-10-08 16:20:24 +02:00
|
|
|
unless params[:name].blank? # Search by name
|
|
|
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:name]}%")
|
|
|
|
end
|
|
|
|
|
|
|
|
if params[:only_active] # Select only active groups
|
2021-03-17 13:12:13 +01:00
|
|
|
@ordergroups = @ordergroups.active
|
2012-10-08 16:20:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
2009-08-02 18:12:13 +02:00
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html # index.html.erb
|
2011-05-18 11:47:00 +02:00
|
|
|
format.js { render :layout => false }
|
2009-08-02 18:12:13 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|