General functionality improvement

This commit is contained in:
2014-06-26 17:26:15 +02:00
parent 8730d30621
commit 2a30ff5d3d
19 changed files with 71 additions and 52 deletions
@@ -1,5 +1,5 @@
App.TableController = Ember.ObjectController.extend
join_request_sent: false
join_request_sent: (-> @get('controllers.application.join_request_sent')).property('controllers.application.join_request_sent')
tableCanTakeOrders: (->
return false unless @get('supplier.can_take_orders')
list = @get('controllers.application.list')
@@ -14,7 +14,7 @@ App.TableController = Ember.ObjectController.extend
showJoinButton: (->
return false unless @get('supplier.can_take_orders')
return false if @get('controllers.application.list') # if you already have an active list, do not join another
if @get('model.occupied') then true else false
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
).property('controllers.application.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'controllers.application.list.table.id')
actions:
addProduct: (product)->
@@ -25,7 +25,7 @@ App.TableController = Ember.ObjectController.extend
joinOccupiedTable: ->
#@secured =>
Ember.$.post('/user/join_occupied_table.json', table_id: @get('model.id'))
@set 'join_request_sent', true # keeps the button deactivated
@set 'controllers.application.join_request_sent', true # keeps the button deactivated
toggleProductCategory: (product_category)->
product_category.set 'collapsed', not product_category.get('collapsed')
showProductDescription: (product)->