Waiter app progress

This commit is contained in:
2015-03-24 18:40:55 +01:00
parent 90a2a2087b
commit 792a31edfd
11 changed files with 72 additions and 22 deletions
@@ -0,0 +1,8 @@
class Waiter::SectionsController < Waiter::ApplicationController
def index
sections = current_supplier.sections.include_relation(:tables)
render json: sections, each_serializer: Waiter::SectionSerializer
end
end
@@ -0,0 +1,7 @@
class Waiter::SuppliersController < Waiter::ApplicationController
def show
@supplier = Supplier.find(params[:id])
head 404 and return unless @supplier.employee_ids.include?(current_employee.id)
render json: @supplier, serializer: Waiter::SupplierSerializer
end
end
-16
View File
@@ -4,14 +4,6 @@ class WaiterController < ApplicationController
end
def sections
sections = current_supplier.sections.include_relation(:tables)
respond_to do |format|
format.html { redirect_to '/waiter'}
format.json { render json: sections, each_serializer: Waiter::SectionSerializer }
end
end
def product_categories
respond_to do |format|
format.html { redirect_to '/waiter'}
@@ -25,12 +17,4 @@ class WaiterController < ApplicationController
@list.place_order products: params[:order], employee: current_employee
render nothing: true
end
def current_supplier
@current_supplier ||= Supplier.first
end
def current_employee
@current_employee ||= current_supplier.employees.first
end
end