move to evented mustache system

This commit is contained in:
2012-11-28 20:15:59 +01:00
parent 3da9dc68d7
commit 0fa0d1e0ba
31 changed files with 324 additions and 176 deletions
+2 -8
View File
@@ -71,10 +71,8 @@ class SupplierController < ApplicationController
h[:lists] = []
grand_total = 0.0
for list in @supplier.active_lists(section_id: params[:section_id].presence)
hl = list.as_json
hl[:total_amount] = list.orders.inject(0.0){|sum, o| sum + o.product_orders.inject(0.0){|s, po| s + (po.amount * po.price).round(2)}}.round(2)
hl = list.with_info_as_json
grand_total += hl[:total_amount]
hl[:section_title] = list.table.section.try(:title)
h[:lists] << hl
end
h[:total_amount] = grand_total.round(2)
@@ -87,17 +85,13 @@ class SupplierController < ApplicationController
def close_list
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:list_id])
@list.close!
for user_id in @list.user_ids
broadcast_user user_id, 'list_closed', @list
end
render nothing: true
end
# POST /orders/1/is_helped
def mark_list_as_helped
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:list_id])
@list.needs_help = false
@list.save
@list.is_helped!
render nothing: true
end