Supplier mail changing and polishing

This commit is contained in:
2013-12-11 16:00:35 +01:00
parent 0ac9a70797
commit 8aede39b27
28 changed files with 207 additions and 72 deletions
+23 -8
View File
@@ -3,6 +3,27 @@ module Suppliers
# GET /lists
# GET /lists.json
def index
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
@lists.include_relation(:table)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lists }
end
end
def active
@lists = List.active_for_supplier(current_supplier.id)
@lists.include_relation(:table) # for number
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lists }
end
end
def at_date
@date = params[:date].present? ? (Date.parse(params[:date]) rescue Date.today) : Date.today
@time = @date.to_time(:utc)
@start_time = @time.beginning_of_day
@@ -11,14 +32,8 @@ module Suppliers
@start_time += current_supplier.night_offset.to_f.hours
@end_time += current_supplier.night_offset.to_f.hours
end
if params[:show_all] == 'yes'
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
elsif params[:state] == 'active'
@lists = List.active_for_supplier(current_supplier.id)
else
@lists = List.for_supplier_created_at current_supplier, @start_time..@end_time
end
@lists.include_relation(:table)
@lists = List.for_supplier_created_at current_supplier, @start_time..@end_time
@lists.include_relation(:table) # for number
respond_to do |format|
format.html # index.html.erb