move to evented mustache system
This commit is contained in:
@@ -93,6 +93,27 @@ class UserController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def list_products_for_table
|
||||
@table = Table.find(params[:table_id])
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
end
|
||||
format.json do
|
||||
products = @table.supplier.products
|
||||
products.include_relation(:product_categories)
|
||||
products.sort_by!{|p| p.product_category.try(:position) || 90000}
|
||||
h = products.inject({
|
||||
table_number: @table.number,
|
||||
supplier_name: @table.supplier.name,
|
||||
has_occupied_info: true,
|
||||
is_occupied: @table.occupied?
|
||||
}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
|
||||
render json: h
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def join_occupied_table
|
||||
@table = Table.find(params[:table_id])
|
||||
end
|
||||
@@ -149,26 +170,6 @@ class UserController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def list_products_for_table
|
||||
@table = Table.find(params[:table_id])
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
end
|
||||
format.json do
|
||||
products = @table.supplier.products
|
||||
products.include_relation(:product_categories)
|
||||
products.sort_by!{|p| p.product_category.try(:position) || 90000}
|
||||
h = products.inject({
|
||||
table_number: @table.number,
|
||||
supplier_name: @table.supplier.name,
|
||||
has_occupied_info: true,
|
||||
is_occupied: @table.occupied?
|
||||
}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
|
||||
render json: h
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /user/current_list.json
|
||||
# Information about the currently active list
|
||||
# This information includes detailed order information
|
||||
@@ -214,6 +215,7 @@ class UserController < ApplicationController
|
||||
render json: {list_active: false} and return unless list.present?
|
||||
list.needs_help = true
|
||||
list.save
|
||||
broadcast_supplier(list.supplier_id, 'list_needs_help', id: list.id)
|
||||
render json: list.as_json.merge(list_active: list.active?)
|
||||
end
|
||||
end
|
||||
@@ -224,8 +226,7 @@ class UserController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render json: {list_active: false} and return unless list.present?
|
||||
list.needs_payment = true
|
||||
list.save
|
||||
list.needs_payment!
|
||||
render json: list.as_json.merge(list_active: list.active?)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user