Add concept waiter section

This commit is contained in:
2014-03-23 15:30:21 +01:00
parent 37970e5bef
commit 474d5f88c6
45 changed files with 367 additions and 103 deletions
+9 -5
View File
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'rails', '4.0.4'
gem 'rack-cors', :require => 'rack/cors'
# Bundle edge Rails instead:
@@ -14,15 +14,16 @@ gem 'jquery-ui-rails'
gem 'ember-source' #, github: 'emberjs/ember.js', require: 'ember/source'
gem 'ember-rails'
gem 'slim-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails' #, '~> 3.2.3'
gem 'sass-rails', '~> 4.0.2'
gem 'coffee-rails' #, '~> 3.2.1'
#gem 'twitter-bootstrap-rails'
gem 'bootstrap-sass', '~>2.3.2.2'
gem 'bourbon'
gem 'compass-rails'
gem 'bootstrap-sass', '~>2.3'
#gem 'bourbon'
#gem 'compass-rails'
gem 'js-routes'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
@@ -30,6 +31,8 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
gem 'emblem-rails'
gem 'foundation-rails'
#gem 'mustache' #, :require => 'mustache/railtie'
end
@@ -49,6 +52,7 @@ gem "omniauth-facebook"
gem 'simple_form'
gem 'active_decorator' #, path: '/Users/bterkuile/companytools/development/rails/components/active_decorator'
#gem 'cmtool', github: 'bterkuile/cmtool'
gem 'paperclip', '3.5.2' # cmtool
gem 'cmtool', path: './../cmtool'
gem 'kaminari'
+96 -94
View File
@@ -57,11 +57,11 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.2)
actionpack (= 4.0.2)
actionmailer (4.0.4)
actionpack (= 4.0.4)
mail (~> 2.5.4)
actionpack (4.0.2)
activesupport (= 4.0.2)
actionpack (4.0.4)
activesupport (= 4.0.4)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
@@ -69,23 +69,23 @@ GEM
active_decorator (0.3.4)
active_model_serializers (0.8.1)
activemodel (>= 3.0)
activemodel (4.0.2)
activesupport (= 4.0.2)
activemodel (4.0.4)
activesupport (= 4.0.4)
builder (~> 3.1.0)
activerecord (4.0.2)
activemodel (= 4.0.2)
activerecord (4.0.4)
activemodel (= 4.0.4)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.2)
activesupport (= 4.0.4)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4)
activesupport (4.0.4)
i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.5)
arel (4.0.1)
arel (4.0.2)
atomic (1.1.16)
barber (0.4.2)
ember-source
@@ -94,14 +94,14 @@ GEM
barber-emblem (0.1.1)
barber (>= 0.4.1)
emblem-source
bcrypt-ruby (3.1.2)
bcrypt (3.1.7)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
bourbon (3.1.8)
sass (>= 3.2.0)
thor
builder (3.1.4)
capybara (2.2.0)
capybara (2.2.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
@@ -110,7 +110,6 @@ GEM
capybara-webkit (1.1.0)
capybara (~> 2.0, >= 2.0.2)
json
chunky_png (1.2.9)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.3)
@@ -122,15 +121,9 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
compass-rails (1.1.2)
compass (>= 0.12.2)
coffee-script-source (1.7.0)
connection_pool (1.2.0)
cookiejar (0.3.0)
cookiejar (0.3.2)
couchbase (1.3.6)
connection_pool (~> 1.0, >= 1.0.0)
multi_json (~> 1.0)
@@ -145,19 +138,20 @@ GEM
rest-client (~> 1.6.1)
daemons (1.1.9)
database_cleaner (1.2.0)
devise (3.2.2)
bcrypt-ruby (~> 3.0)
devise (3.2.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
em-http-request (1.1.1)
docile (1.1.3)
em-http-request (1.1.2)
addressable (>= 2.3.4)
cookiejar
em-socksify (>= 0.3)
eventmachine (>= 1.0.3)
http_parser.rb (>= 0.6.0.beta.2)
http_parser.rb (>= 0.6.0)
em-socksify (0.3.0)
eventmachine (>= 1.0.0.beta.4)
email_validator (1.4.0)
@@ -178,17 +172,17 @@ GEM
emblem-rails (0.2.1)
barber-emblem (~> 0.1.1)
ember-rails (>= 0.14.0)
emblem-source (0.3.5)
emblem-source (0.3.12)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.0.2)
factory_girl (4.3.0)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.3.0)
factory_girl (~> 4.3.0)
factory_girl_rails (4.4.1)
factory_girl (~> 4.4.0)
railties (>= 3.0.0)
faraday (0.8.8)
multipart-post (~> 1.2.0)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
faye (1.0.1)
cookiejar (>= 0.3.0)
em-http-request (>= 0.3.0)
@@ -197,16 +191,18 @@ GEM
multi_json (>= 1.0.0)
rack (>= 1.0.0)
websocket-driver (>= 0.3.0)
faye-websocket (0.7.1)
faye-websocket (0.7.2)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.3.1)
fssm (0.2.10)
foundation-rails (5.2.1.0)
railties (>= 3.1.0)
sass (>= 3.2.0)
fuubar (1.3.2)
rspec (>= 2.14.0, < 3.1.0)
ruby-progressbar (~> 1.3)
gherkin (2.12.2)
multi_json (~> 1.3)
haml (4.0.4)
haml (4.0.5)
tilt
haml-rails (0.5.3)
actionpack (>= 4.0.1)
@@ -217,19 +213,19 @@ GEM
hashie (2.0.5)
hike (1.2.3)
http_parser.rb (0.6.0)
httpauth (0.2.0)
i18n (0.6.9)
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.1.1)
railties (>= 3.1.0)
js-routes (0.9.6)
rails (>= 3.2)
jquery-ui-rails (4.2.0)
railties (>= 3.2.16)
js-routes (0.9.7)
railties (>= 3.2)
sprockets-rails
json (1.8.1)
jwt (0.1.8)
jwt (0.1.11)
multi_json (>= 1.5)
kaminari (0.15.0)
kaminari (0.15.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
launchy (2.4.2)
@@ -247,30 +243,33 @@ GEM
mini_portile (0.5.2)
minitest (4.7.5)
multi_json (1.9.2)
multipart-post (1.2.0)
multi_xml (0.5.5)
multipart-post (2.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
oauth2 (0.8.1)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
oauth2 (0.9.3)
faraday (>= 0.8, < 0.10)
jwt (~> 0.1.8)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
omniauth (1.1.4)
omniauth (1.2.1)
hashie (>= 1.2, < 3)
rack
omniauth-facebook (1.5.1)
omniauth-oauth2 (~> 1.1.0)
omniauth-oauth2 (1.1.1)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
rack (~> 1.0)
omniauth-facebook (1.6.0)
omniauth-oauth2 (~> 1.1)
omniauth-oauth2 (1.1.2)
faraday (>= 0.8, < 0.10)
multi_json (~> 1.3)
oauth2 (~> 0.9.3)
omniauth (~> 1.2)
paperclip (3.5.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
pry (0.9.12.4)
polyglot (0.3.4)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
@@ -282,17 +281,17 @@ GEM
rack-cors (0.2.9)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.2)
actionmailer (= 4.0.2)
actionpack (= 4.0.2)
activerecord (= 4.0.2)
activesupport (= 4.0.2)
rails (4.0.4)
actionmailer (= 4.0.4)
actionpack (= 4.0.4)
activerecord (= 4.0.4)
activesupport (= 4.0.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
railties (= 4.0.4)
sprockets-rails (~> 2.0.0)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
railties (4.0.4)
actionpack (= 4.0.4)
activesupport (= 4.0.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.1.1)
@@ -303,43 +302,46 @@ GEM
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.0)
rspec-mocks (2.14.6)
rspec-rails (2.14.2)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-progressbar (1.3.2)
sass (3.2.13)
sass-rails (4.0.1)
ruby-progressbar (1.4.2)
sass (3.2.18)
sass-rails (4.0.2)
railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0.0)
simple_form (3.0.1)
actionpack (>= 4.0.0, < 4.1)
activemodel (>= 4.0.0, < 4.1)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slim (2.0.2)
temple (~> 0.6.6)
tilt (>= 1.3.3, < 2.1)
slim-rails (2.0.4)
slim-rails (2.1.2)
actionpack (>= 3.0, < 4.1)
activesupport (>= 3.0, < 4.1)
railties (>= 3.0, < 4.1)
slim (~> 2.0)
slop (3.4.7)
slop (3.5.0)
spring (1.1.2)
spring-commands-rspec (1.0.1)
spring (>= 0.9.1)
sprockets (2.10.1)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
@@ -350,29 +352,29 @@ GEM
sprockets (~> 2.8)
subexec (0.2.3)
temple (0.6.7)
thin (1.6.1)
thin (1.6.2)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
thor (0.18.1)
thor (0.19.0)
thread_safe (0.3.1)
atomic (>= 1.1.7, < 2)
tilt (1.4.1)
tinymce-rails (4.0.11)
tinymce-rails (4.0.19)
railties (>= 3.1.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turnip (1.1.0)
turnip (1.2.1)
gherkin (>= 2.5)
rspec (~> 2.0)
rspec (>= 2.0, < 4.0)
tzinfo (0.3.39)
uglifier (2.4.0)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)
websocket-driver (0.3.1)
websocket-driver (0.3.2)
xpath (2.0.0)
nokogiri (~> 1.3)
yaji (0.3.5)
@@ -382,13 +384,11 @@ PLATFORMS
DEPENDENCIES
active_decorator
bootstrap-sass (~> 2.3.2.2)
bourbon
bootstrap-sass (~> 2.3)
capybara
capybara-webkit
cmtool!
coffee-rails
compass-rails
couch_potato!
couchbase
couchbase-docstore
@@ -401,6 +401,7 @@ DEPENDENCIES
emblem-rails
factory_girl_rails
faye
foundation-rails
fuubar
jquery-rails
jquery-ui-rails
@@ -412,13 +413,14 @@ DEPENDENCIES
mini_magick
omniauth-facebook
orm_adapter!
paperclip (= 3.5.2)
pry-rails
quiet_assets
rack-cors
rails (= 4.0.2)
rails (= 4.0.4)
rqrcode
rspec-rails
sass-rails
sass-rails (~> 4.0.2)
simple_form
simplecov
simply_stored!
@@ -0,0 +1 @@
#= require_directory .
@@ -0,0 +1,3 @@
Ember.Handlebars.registerBoundHelper 'currency', (amount, params..., options)->
amount = 0.0 if isNaN(amount) || amount== '' || amount == null
new Handlebars.SafeString('&euro;&nbsp;' + parseFloat(amount).toFixed(2))
@@ -1,3 +1,4 @@
Qsupplier.App = Ember.Application.create
LOG_TRANSITIONS: true
rootElement: '#ember-app-container'
@App = Qsupplier.App
@@ -2,6 +2,7 @@
#= require ember
#= require ember-data
#= require_directory ./modifications
#= require shared-ember-helpers/all
#= require ./app
#= require_tree .
@EmberENV = {FEATURES: {'query-params-new': true}}
@@ -1,2 +0,0 @@
Ember.Handlebars.registerBoundHelper 'currency', (amount, params..., options)->
new Handlebars.SafeString Qwaiter.currency(amount)
@@ -0,0 +1,3 @@
@App = Ember.Application.create
LOG_TRANSITIONS: true
rootElement: '#ember-app-container'
@@ -0,0 +1,8 @@
#= require_self
#= require handlebars
#= require ember
#= require ember-data
#= require shared-ember-helpers/all
#= require ./app
#= require_tree .
@EmberENV = {FEATURES: {'query-params-new': true}}
@@ -0,0 +1,11 @@
App.ProductCategoriesController = Ember.ArrayController.extend
needs: ['table']
actions:
addProduct: (product)->
if table = @get('controllers.table.model')
if existing = @store.all('product_order').find((po)->po.get('table') == table and po.get('product') == product)
existing.increment()
else
@store.createRecord 'product_order', table: table, product: product
else
alert "Please select a table first"
@@ -0,0 +1 @@
App.SectionsController = Ember.ArrayController.extend {}
@@ -0,0 +1,8 @@
App.TableController = Ember.ObjectController.extend
orderTotal: (->
@get('product_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
).property('product_orders.@each.quantity')
actions:
clearProductOrders: ->
@get('product_orders').every (product_order)->product_order.deleteRecord()
@@ -0,0 +1,12 @@
attr = DS.attr
App.List = DS.Model.extend
state: attr 'string'
needs_help: attr 'boolean'
needs_payment: attr 'boolean'
is_paid: attr 'boolean'
has_active_orders: attr 'boolean'
price: attr 'number'
table_number: attr 'number'
table: DS.belongsTo('table', inverse: 'active_list')
section: DS.belongsTo('section')
section_id: attr('string')
@@ -0,0 +1,6 @@
attr = DS.attr
App.Product = DS.Model.extend
name: attr 'string'
price: attr 'number'
product_category: DS.belongsTo('product_category')
product_orders: DS.hasMany('product_order')
@@ -0,0 +1,4 @@
attr = DS.attr
App.ProductCategory = DS.Model.extend
name: attr 'string'
products: DS.hasMany('product')
@@ -0,0 +1,8 @@
attr = DS.attr
App.ProductOrder = DS.Model.extend
quantity: attr 'number', defaultValue: 1
product: DS.belongsTo('product')
table: DS.belongsTo('table')
increment: ->
@set('quantity', @get('quantity') + 1)
total: (-> @get('quantity') * @get('product.price')).property('quantity')
@@ -0,0 +1,6 @@
attr = DS.attr
App.Section = DS.Model.extend
title: attr 'string'
width: attr 'number'
height: attr 'number'
tables: DS.hasMany('table')
@@ -0,0 +1,14 @@
attr = DS.attr
App.Table = DS.Model.extend
number: attr 'number'
width: attr 'number'
height: attr 'number'
position_x: attr 'number'
position_y: attr 'number'
occupied: attr 'boolean'
section: DS.belongsTo('section')
product_orders: DS.hasMany('product_order')
#active_list: DS.belongsTo('list')
#active_list: (->
#@get('list')
#).property('list')
@@ -0,0 +1,11 @@
# For more information see: http://emberjs.com/guides/routing/
# and for queryParams: https://github.com/alexspeller/website/blob/a96d9afe4506454b155cc64299e86e558ce3c9f1/source/guides/routing/query-params.md
App.Router.reopen
location: 'history'
rootURL: '/waiter'
App.Router.map ->
@resource 'sections', ->
@resource 'section', path: ':section_id', ->
@resource 'tables', ->
@resource 'table', path: ':table_id'
@@ -0,0 +1,3 @@
App.ApplicationRoute = Ember.Route.extend
setupController: ->
@controllerFor('product_categories').set 'model', @store.find('product_category')
@@ -0,0 +1,2 @@
App.IndexRoute = Ember.Route.extend
redirect: -> @transitionTo('sections')
@@ -0,0 +1,2 @@
App.SectionsRoute = Ember.Route.extend
model: -> @store.find('section')
@@ -0,0 +1,13 @@
# http://emberjs.com/guides/models/defining-a-store/
DS.RESTAdapter.reopen
namespace: 'waiter'
App.ApplicationSerializer = DS.ActiveModelSerializer
App.CustomAdapter = DS.RESTAdapter.extend
# user underscored paths
pathForType: (type)->
decamelized = Ember.String.decamelize(type)
Ember.String.pluralize(decamelized)
App.Store = DS.Store.extend
adapter: App.CustomAdapter
@@ -0,0 +1,5 @@
.row
.twelve.columns
h1 Qwaiter
hr
.waiter-application-container= outlet
@@ -0,0 +1 @@
@@ -0,0 +1,10 @@
h2 Food!
each product_category in controller
if product_category.products
h5= product_category.name
hr
ul.product_category-products
each product in product_category.products
li
a{action addProduct product } href="#" = product.name
@@ -0,0 +1,8 @@
.row
.section-tables.small-12.medium-6.large-4.columns
h2 Tables
each table in tables
= link-to 'table' table class="panel section-table"
= table.number
.small-12.medium-6.large-4.columns= render 'product_categories'
.large-4.columns= outlet
@@ -0,0 +1,10 @@
dl.sub-nav
dt Section:
each section in controller
dd
= link-to 'section' section
= section.title
else
dd No available sections
hr
= outlet
@@ -0,0 +1,19 @@
hr.hide-for-large-up
if product_orders
a.tiny.button.right{action clearProductOrders} href="#" x
h4
| Table
= number
.panel
ul.product-orders
each product_order in product_orders
li
= product_order.quantity
| x
= product_order.product.name
span.currency=currency product_order.product.price
else
li No products
li.total
| Total
span.currency=currency orderTotal
@@ -0,0 +1,7 @@
#= require jquery
#= require jquery_ujs
#= require ./app/application
#= require foundation
#= require_directory .
#= require_self
$(document).foundation()
@@ -0,0 +1,2 @@
//= require foundation
//= require_directory .
@@ -0,0 +1,3 @@
li
span.currency
float: right
@@ -0,0 +1,2 @@
ul.product_category-products
list-style: none
@@ -0,0 +1,8 @@
ul.product-orders
list-style: none
li
border-bottom: 1px solid #ccc
&.total
border-bottom: none
border-top: 4px solid #333
font-weight: bold
@@ -0,0 +1,15 @@
.section-tables
.section-table
width: 72px
float: left
margin-right: 20px
border: 1px solid #d8d8d8
padding: 0.8rem
background-color: #f2f2f2
margin-bottom: 1rem
text-align: center
&:hover
background-color: #e6e6e6
&.active, &.active:hover
background-color: #333
color: white
+21
View File
@@ -0,0 +1,21 @@
class WaiterController < ApplicationController
layout 'waiter'
def index
end
def sections
json = '{"tables":[{"id":"0903d04a003991835f9f32d1821ee05c","number":102,"width":2.0,"height":2.0,"position_x":14.242294520547945,"position_y":3.1862955032119915,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","occupied":true,"active_list_id":"1cef487ec268169687f481cb828924c2"},{"id":"0903d04a003991835f9f32d1821efb50","number":100,"width":2.0,"height":2.0,"position_x":6.5,"position_y":6.5,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d15fa","number":11,"width":2.0,"height":2.0,"position_x":6.5,"position_y":1.5,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","occupied":false,"active_list_id":null},{"id":"0903d04a003991835f9f32d1821ededd","number":103,"width":2.0,"height":2.0,"position_x":9.0,"position_y":6.5,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"0903d04a003991835f9f32d1821eee07","number":101,"width":2.0,"height":2.0,"position_x":2.3333333333333335,"position_y":6.5,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d0dbd","number":12,"width":2.0,"height":2.0,"position_x":9.854452054794521,"position_y":2.7054794520547945,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d2221","number":10,"width":2.0,"height":2.0,"position_x":6.4811643835616435,"position_y":2.0034246575342465,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d2cf7","number":1,"width":2.0,"height":2.0,"position_x":2.3333333333333335,"position_y":1.5,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null}],"lists":[{"id":"1cef487ec268169687f481cb828924c2","state":"active","needs_help":true,"needs_payment":false,"is_paid":false,"price":46.8,"table_id":"0903d04a003991835f9f32d1821ee05c","table_number":102,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","has_active_orders":true,"user_ids":["8afe7cccf1c690e60aa2ace1bf1d8a71"]}],"sections":[{"id":"1a9d4cc551dac96f87a21c97ba1e710b","title":"Ruimte2","path":[[0.0,0.0],[30.0,12.0],[30.0,12.0],[0.0,12.0]],"width":30.0,"height":12.0,"table_ids":["0903d04a003991835f9f32d1821ee05c","0903d04a003991835f9f32d1821efb50","1a9d4cc551dac96f87a21c97ba3d15fa"]},{"id":"222fcd43b55e397d11d92ccb601e70dc","title":"Buiten","path":[[0.0,0.0],[20.0,20.0],[20.0,20.0],[0.0,20.0]],"width":20.0,"height":20.0,"table_ids":["0903d04a003991835f9f32d1821ededd","0903d04a003991835f9f32d1821eee07","1a9d4cc551dac96f87a21c97ba3d0dbd","1a9d4cc551dac96f87a21c97ba3d2221","1a9d4cc551dac96f87a21c97ba3d2cf7"]}]}'
respond_to do |format|
format.html { redirect_to '/waiter'}
format.json { render json: json }
end
end
def product_categories
respond_to do |format|
format.html { redirect_to '/waiter'}
format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer }
end
end
end
+1
View File
@@ -1,5 +1,6 @@
class Product
include SimplyStored::Couch
include ActiveModel::SerializerSupport
property :name
property :code
+1
View File
@@ -1,5 +1,6 @@
class ProductCategory
include SimplyStored::Couch
include ActiveModel::SerializerSupport
property :name
property :position, type: Fixnum, default: 0
@@ -0,0 +1,5 @@
class ProductCategorySerializer < Qwaiter::Serializer
embed :ids, include: true
attributes :name
has_many :products
end
+4
View File
@@ -0,0 +1,4 @@
class ProductSerializer < Qwaiter::Serializer
embed :ids, include: true
attributes :name, :price
end
+13
View File
@@ -0,0 +1,13 @@
doctype html
html lang="en"
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title Qwaiter
/= stylesheet_link_tag "waiter/application", media: "all"
= stylesheet_link_tag "waiter/application"
= javascript_include_tag "vendor/modernizr"
= javascript_include_tag "waiter/application"
body
#ember-app-container
+2 -2
View File
@@ -76,7 +76,7 @@ module Qwaiter
config.active_support.escape_html_entities_in_json = true
config.handlebars.templates_root = %w[supplier/app/templates]
config.handlebars.templates_root = %w[supplier/app/templates waiter/app/templates]
config.generators do |g|
g.orm :simply_stored
@@ -101,7 +101,7 @@ module Qwaiter
# Enable the asset pipeline
config.assets.enabled = true
config.assets.precompile += ['supplier/application.css', 'user/application.css', 'qr_sheet/application.css']
config.assets.precompile += ['supplier/application.css', 'user/application.css', 'qr_sheet/application.css', 'waiter/application.css']
config.default_url_options = {format: 'html'}
config.to_prepare do
+7
View File
@@ -25,6 +25,13 @@ Qwaiter::Application.routes.draw do
get '/supplier/active_lists' => 'supplier#active_lists', as: :supplier_active_lists
#get '/supplier/lists/:list_id' => 'supplier#show_list', as: :supplier_show_list
#WAITER
get '/waiter' => 'waiter#index' #, controller: 'waiter', action: 'index'
get '/waiter/sections' => 'waiter#sections'
get '/waiter/product_categories' => 'waiter#product_categories'
get '/waiter/*rest' => redirect('/waiter') # Ember app refresh
post '/supplier/close_list' => 'supplier#close_list', as: :supplier_close_list
post '/supplier/mark_list_as_helped' => 'supplier#mark_list_as_helped', as: :supplier_mark_list_as_helped