Ember temp commit

This commit is contained in:
2013-09-24 08:47:30 +02:00
parent ebbb5dedfc
commit 5650ada04c
71 changed files with 595 additions and 66 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
before_filter :set_locale
layout :layout_by_resource
protect_from_forgery
#protect_from_forgery
rescue_from SimplyStored::RecordNotFound, with: :show_404
@@ -13,6 +13,8 @@ module Suppliers
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
@@ -31,7 +33,7 @@ module Suppliers
respond_to do |format|
format.html {}
format.json do
render json: @list.with_orders_as_json
render json: {list: @list.with_orders_as_json}
end
end
end
@@ -0,0 +1,18 @@
module Suppliers
class OrdersController < Suppliers::ApplicationController
# GET /tables
# GET /tables.json
def index
if params[:state] == 'active'
@orders = Order.active_for_supplier(current_supplier.id)
else
@orders = Order.for_supplier(current_supplier, page: params[:page], per_page: params['per_page'] || 10)
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: {orders: @orders.map(&:with_products_as_json)} }
end
end
end
end
@@ -86,10 +86,9 @@ module Suppliers
end
def preview_products
@date = Date.parse(params[:date]) rescue Date.today
product_categories = ProductCategory.for_supplier_in_time(current_supplier, @date.to_time)
@time = Time.parse(params[:date]) rescue Time.now
product_categories = ProductCategory.for_supplier_in_time(current_supplier, @time)
render json: {categories: product_categories.map(&:to_client_format).select(&:present?)}
end
end
end
@@ -19,9 +19,10 @@ module Suppliers
# GET /sections/1.json
def show
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
@tables = @section.tables_with_active_list_id
respond_to do |format|
format.html # show.html.erb
format.html { render action: 'tables_view' }# show.html.erb
format.json { render json: @section }
end
end
@@ -103,7 +104,7 @@ module Suppliers
# GET /sections/1/tables_view.json
def tables_view
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
@tables = Table.enrich_active_list_id(@section.tables)
@tables = @section.tables_with_active_list_id
respond_to do |format|
format.html # show.html.erb
@@ -57,8 +57,8 @@ module Suppliers
end
end
# PUT /tables/1
# PUT /tables/1.json
# PUT /supplier/tables/1
# PUT /supplier/tables/1.json
def update
@table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:id])