End for day commit
This commit is contained in:
@@ -23,7 +23,7 @@ Globals = Ember.Object.extend
|
|||||||
Ember.Application.initializer
|
Ember.Application.initializer
|
||||||
name: 'Globals'
|
name: 'Globals'
|
||||||
initialize: (container, application)->
|
initialize: (container, application)->
|
||||||
container.typeInjection('component', 'store', 'store:main')
|
container.typeInjection('component', 'store', 'service:store')
|
||||||
application.register('global:variables', Globals, {singleton: true})
|
application.register('global:variables', Globals, {singleton: true})
|
||||||
application.inject('controller', 'globals', 'global:variables')
|
application.inject('controller', 'globals', 'global:variables')
|
||||||
application.inject('component', 'globals', 'global:variables')
|
application.inject('component', 'globals', 'global:variables')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
App.ListOrderComponent = Ember.Component.extend
|
App.ListOrderComponent = Ember.Component.extend
|
||||||
classNames: 'list-order-container'
|
classNames: 'list-order-container'
|
||||||
classNameBindings: ['order.state', 'contentWrapClass']
|
classNameBindings: ['order.state', 'contentWrapClass']
|
||||||
#templateName: 'components/list-order'
|
#layoutName: 'components/list-order'
|
||||||
contentWrapClass: (-> "order-row-#{@get('order.id')}").property('order.id')
|
contentWrapClass: (-> "order-row-#{@get('order.id')}").property('order.id')
|
||||||
#click: ->
|
#click: ->
|
||||||
#if @route_param
|
#if @route_param
|
||||||
@@ -12,6 +12,6 @@ App.ListOrderComponent = Ember.Component.extend
|
|||||||
#if @get('controller.currentPath') == @route then 'active' else ''
|
#if @get('controller.currentPath') == @route then 'active' else ''
|
||||||
#).property('controller.currentPath')
|
#).property('controller.currentPath')
|
||||||
#init: ->
|
#init: ->
|
||||||
#@templateName = "menu_item_#{@route}"
|
#@layoutName = "menu_item_#{@route}"
|
||||||
#@_super()
|
#@_super()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
App.ListsIndexEntryComponent = Ember.Component.extend
|
||||||
|
layoutName: 'lists/index-entry'
|
||||||
|
classNames: ['lists-overview-entry']
|
||||||
|
classNameBindings: ['content.active:active']
|
||||||
|
click: ->
|
||||||
|
debugger
|
||||||
|
@get('controller').transitionToRoute 'list', @get('list')
|
||||||
+1
-1
@@ -10,7 +10,7 @@ App.MenuProductCategoriesComponent = Ember.Component.extend
|
|||||||
return true if product_category.get('full_day')
|
return true if product_category.get('full_day')
|
||||||
product_category.get('start_from') <= @get('clock.minute_of_day') and @get('clock.minute_of_day') <= product_category.get('end_on')
|
product_category.get('start_from') <= @get('clock.minute_of_day') and @get('clock.minute_of_day') <= product_category.get('end_on')
|
||||||
list.sortBy('position')
|
list.sortBy('position')
|
||||||
).property('product_categories.@each', 'clock.minute_of_day')
|
).property('product_categories.[]', 'clock.minute_of_day')
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
toggleProductCategory: (product_category) -> product_category.toggleProperty('collapsed')
|
toggleProductCategory: (product_category) -> product_category.toggleProperty('collapsed')
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
App.MenuItemComponent = Ember.Component.extend
|
||||||
|
classNames: 'menu-list-item'
|
||||||
|
classNameBindings: ['active']
|
||||||
|
click: ->
|
||||||
|
if route_param = @get('route_param')
|
||||||
|
@get('targetObject').transitionToRoute(@get('route'), route_param)
|
||||||
|
else
|
||||||
|
@get('targetObject').transitionToRoute(@get('route'))
|
||||||
|
active: (->
|
||||||
|
if @get('targetObject.currentPath') == @get('route') then 'active' else ''
|
||||||
|
).property('targetObject.currentPath')
|
||||||
|
setTemplate: (-> @layoutName = "components/menu/#{@get('route')}").on('init')
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
App.MenuItemProductOrdersComponent = Ember.Component.extend
|
||||||
|
all_product_orders: Ember.computed -> @store.peekAll('product-order')
|
||||||
|
product_orders: Ember.computed 'all_product_orders.[]', -> @get('all_product_orders').filterBy('isNew')
|
||||||
|
layoutName: 'components/menu/product_orders'
|
||||||
|
classNames: ['menu-list-item', 'menu-list-item-product-orders']
|
||||||
|
classNameBindings: ['product_orders.length:show:hide', 'currentRoute:active']
|
||||||
|
currentRoute: (-> @get('targetObject.currentRouteName') is 'product_orders' ).property('targetObject.currentRouteName')
|
||||||
|
orderTotals: Ember.computed.mapBy 'product_orders', 'total'
|
||||||
|
orderTotal: Ember.computed.sum 'orderTotals'
|
||||||
|
#orderTotal: Ember.computed 'product_orders.@each.total', ->
|
||||||
|
# debugger
|
||||||
|
click: ->
|
||||||
|
@get('targetObject').transitionToRoute 'product_orders'
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
App.MenuItemComponent = Ember.Component.extend
|
|
||||||
classNames: 'menu-list-item'
|
|
||||||
classNameBindings: ['active']
|
|
||||||
click: ->
|
|
||||||
if route_param = @get('route_param')
|
|
||||||
@get('reference_controller').transitionToRoute(@get('route'), route_param)
|
|
||||||
else
|
|
||||||
@get('reference_controller').transitionToRoute(@get('route'))
|
|
||||||
active: (->
|
|
||||||
if @get('reference_controller.currentPath') == @get('route') then 'active' else ''
|
|
||||||
).property('reference_controller.currentPath')
|
|
||||||
setTemplate: (-> @templateName = "components/menu/#{@get('route')}").on('init')
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
App.MenuItemListNeedsHelpComponent = Ember.Component.extend Ember.ViewTargetActionSupport,
|
App.MenuItemListNeedsHelpComponent = Ember.Component.extend Ember.ViewTargetActionSupport,
|
||||||
action: 'listNeedsHelp'
|
action: 'listNeedsHelp'
|
||||||
templateName: "components/menu/list_needs_help"
|
layoutName: "components/menu/list_needs_help"
|
||||||
classNames: 'menu-list-item callout'
|
classNames: 'menu-list-item callout'
|
||||||
classNameBindings: ['globals.list.needs_help:active']
|
classNameBindings: ['globals.list.needs_help:active']
|
||||||
click: ->
|
click: ->
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
App.MenuItemListNeedsPaymentComponent = Ember.Component.extend Ember.ViewTargetActionSupport,
|
App.MenuItemListNeedsPaymentComponent = Ember.Component.extend Ember.ViewTargetActionSupport,
|
||||||
action: 'listNeedsPayment'
|
action: 'listNeedsPayment'
|
||||||
templateName: "components/menu/list_needs_payment"
|
layoutName: "components/menu/list_needs_payment"
|
||||||
classNames: 'menu-list-item callout'
|
classNames: 'menu-list-item callout'
|
||||||
classNameBindings: ['controller.list.needs_payment:active']
|
classNameBindings: ['controller.list.needs_payment:active']
|
||||||
click: ->
|
click: ->
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
App.MenuItemProductOrdersComponent = Ember.Component.extend
|
|
||||||
product_orders: (->
|
|
||||||
debugger
|
|
||||||
).property()
|
|
||||||
layoutName: 'components/menu/product_orders'
|
|
||||||
classNames: ['menu-list-item', 'menu-list-item-product-orders']
|
|
||||||
classNameBindings: ['product_orders.length:show:hide', 'currentRoute:active']
|
|
||||||
currentRoute: (-> @get('targetObject.currentRouteName') is 'product_orders' ).property('targetObject.currentRouteName')
|
|
||||||
orderTotal: Ember.computed 'product_orders.@each.total', ->
|
|
||||||
3
|
|
||||||
click: ->
|
|
||||||
@get('controller').transitionToRoute 'product_orders'
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
App.MenuItemScanQrComponent = Ember.Component.extend Ember.ViewTargetActionSupport,
|
App.MenuItemScanQrComponent = Ember.Component.extend Ember.ViewTargetActionSupport,
|
||||||
action: 'scanQr'
|
action: 'scanQr'
|
||||||
templateName: "components/menu/scan_qr"
|
layoutName: "components/menu/scan_qr"
|
||||||
classNames: 'menu-list-item'
|
classNames: 'menu-list-item'
|
||||||
click: -> @triggerAction()
|
click: -> @triggerAction()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
App.ProductOrdersComponent = Ember.Component.extend
|
App.ProductOrdersListComponent = Ember.Component.extend
|
||||||
orderTotal: (->
|
orderTotal: (->
|
||||||
#Math.round(Math.random()*100)
|
#Math.round(Math.random()*100)
|
||||||
@get('product_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
|
@get('product_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
|
||||||
|
|||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
App.SettingsLocaleView = Ember.View.extend
|
App.SettingsLocaleComponent = Ember.Component.extend
|
||||||
templateName: 'settings/locale'
|
layoutName: 'settings/locale'
|
||||||
classNames: 'settings-locale'
|
classNames: 'settings-locale'
|
||||||
classNameBindings: ['current']
|
classNameBindings: ['current']
|
||||||
current: (-> @get('locale') is $locale ).property('controller.locale')
|
current: (-> @get('locale') is $locale ).property('controller.locale')
|
||||||
localeFlag: (->
|
localeFlag: (->
|
||||||
new Ember.Handlebars.SafeString "<img src=\"#{$assets_path}user/flags/flag-#{@get('locale')}.png\">"
|
"<img src=\"#{$assets_path}user/flags/flag-#{@get('locale')}.png\">".htmlSafe()
|
||||||
).property('locale')
|
).property('locale')
|
||||||
click: ->
|
click: ->
|
||||||
setLocale @get('locale')
|
setLocale @get('locale')
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
App.ListsIndexController = Ember.Controller.extend App.PaginationModule,
|
App.ListsIndexController = Ember.Controller.extend App.PaginationModule,
|
||||||
lists: (->@get('model').sortBy('created_at').reverse()).property('model.@each')
|
lists: (->@get('model').sortBy('created_at').reverse()).property('model.[]')
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ App.TableController = Ember.Controller.extend
|
|||||||
return false if @get('globals.list') # if you already have an active list, do not join another
|
return false if @get('globals.list') # if you already have an active list, do not join another
|
||||||
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
|
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
|
||||||
).property('globals.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'globals.list.table.id')
|
).property('globals.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'globals.list.table.id')
|
||||||
unordered_product_orders: Ember.computed -> @store.peekAll('product_order').filterBy('id', null)
|
all_product_orders: Ember.computed -> @store.peekAll('product_order')
|
||||||
|
new_product_orders: Ember.computed 'all_product_orders.@each.isNew', -> @get('all_product_orders').filterBy('isNew')
|
||||||
actions:
|
actions:
|
||||||
joinOccupiedTable: ->
|
joinOccupiedTable: ->
|
||||||
Ember.$.post("#{$data_host}/user/join_occupied_table.json", table_id: @get('model.id'))
|
Ember.$.post("#{$data_host}/user/join_occupied_table.json", table_id: @get('model.id'))
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ App.Product = DS.Model.extend
|
|||||||
addOrderItem: (options = {})->
|
addOrderItem: (options = {})->
|
||||||
#if existing = @store.all('product_order').find((po)-> po.get('product') == product and not po.get('order'))
|
#if existing = @store.all('product_order').find((po)-> po.get('product') == product and not po.get('order'))
|
||||||
if options.product_variant
|
if options.product_variant
|
||||||
existing = @get('product_orders').find( (po)-> !po.get('order') and po.get('product_variant') is options.product_variant )
|
existing = @get('product_orders').find( (po)-> !po.get('isNew') and po.get('product_variant') is options.product_variant )
|
||||||
else
|
else
|
||||||
existing = @get('product_orders').find( (po)-> !po.get('order') )
|
existing = @get('product_orders').find( (po)-> !po.get('isNew') )
|
||||||
|
|
||||||
if existing
|
if existing
|
||||||
existing.increment()
|
existing.increment()
|
||||||
|
|||||||
@@ -34,4 +34,4 @@ App.PaginationModule = Ember.Mixin.create
|
|||||||
page = @loadMore()
|
page = @loadMore()
|
||||||
@set 'lastKnownPage', page
|
@set 'lastKnownPage', page
|
||||||
|
|
||||||
hasMore: (-> @hasMoreFunc()).property('lastKnownPage','firstObject','@each','filtered.@each')
|
hasMore: (-> @hasMoreFunc()).property('lastKnownPage','firstObject','.[]','filtered.[]')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.row
|
.row
|
||||||
h2=t 'models.plural.list'
|
h2=t 'models.plural.list'
|
||||||
each lists as |list|
|
each lists as |list|
|
||||||
= view "list-index" content=list
|
= list-index-entry list=list
|
||||||
.clearfix
|
.clearfix
|
||||||
if hasMore
|
if hasMore
|
||||||
button{action "showMore"}=t 'lists.show_more'
|
button{action "showMore"}=t 'lists.show_more'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
.display-label=t 'settings.language'
|
.display-label=t 'settings.language'
|
||||||
.display-field
|
.display-field
|
||||||
each locales as |locale|
|
each locales as |locale|
|
||||||
= view 'settings-locale' locale=locale
|
= settings-locale locale=locale
|
||||||
.display-row
|
.display-row
|
||||||
.display-label
|
.display-label
|
||||||
.display-field: a.button href="./index.html"=t 'settings.reload_application'
|
.display-field: a.button href="./index.html"=t 'settings.reload_application'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
= view.localeFlag
|
= localeFlag
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
button.join-table-button{action "joinOccupiedTable"}=t 'join_request.requestor.join_this_table'
|
button.join-table-button{action "joinOccupiedTable"}=t 'join_request.requestor.join_this_table'
|
||||||
if tableCanTakeOrders
|
if tableCanTakeOrders
|
||||||
.large-6.columns= menu-product-categories product_categories=supplier.product_categories orderProducts=true
|
.large-6.columns= menu-product-categories product_categories=supplier.product_categories orderProducts=true
|
||||||
.large-6.columns= product-orders table=model product_orders=unordered_product_orders reference_controller=controller
|
.large-6.columns= product-orders-list table=model product_orders=new_product_orders
|
||||||
else
|
else
|
||||||
.large12= menu-product-categories product_categories=supplier.product_categories orderProducts=false
|
.large12= menu-product-categories product_categories=supplier.product_categories orderProducts=false
|
||||||
|
each new_product_orders as |po|
|
||||||
|
.row: b=po.display
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
App.ApplicationView = Ember.View.extend
|
App.ApplicationView = Ember.Component.extend
|
||||||
didInsertElement: ->
|
didRender: ->
|
||||||
# Side menu collapsing
|
# Side menu collapsing
|
||||||
side_menu = @$('.side-menu')
|
side_menu = @$('.side-menu')
|
||||||
side_menu.addClass('closed').click -> side_menu.toggleClass('active').addClass('clicked').toggleClass('closed')
|
side_menu.addClass('closed').click -> side_menu.toggleClass('active').addClass('clicked').toggleClass('closed')
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
App.ListIndexView = Ember.View.extend
|
|
||||||
templateName: 'lists/list_entry'
|
|
||||||
classNames: ['lists-overview-entry']
|
|
||||||
classNameBindings: ['content.active:active']
|
|
||||||
click: -> @get('controller').transitionToRoute 'list', @get('content')
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
App.ModalView = Ember.View.extend
|
App.ModalView = Ember.Component.extend
|
||||||
layoutName: 'modals/layout'
|
layoutName: 'modals/layout'
|
||||||
didInsertElement: ->
|
didInsertElement: ->
|
||||||
sortable = $('.sortable')
|
sortable = @$('.sortable')
|
||||||
controller = @get('controller')
|
controller = @get('controller')
|
||||||
if sortable.length
|
if sortable.length
|
||||||
sortable.sortable
|
sortable.sortable
|
||||||
|
|||||||
Reference in New Issue
Block a user