Fixes for event stream and section view actions
This commit is contained in:
@@ -5,7 +5,7 @@ Qsupplier.App.Table = DS.Model.extend
|
||||
height: attr 'number'
|
||||
position_x: attr 'number'
|
||||
position_y: attr 'number'
|
||||
occupied: attr 'boolean'
|
||||
# occupied: attr 'boolean'
|
||||
section: DS.belongsTo('section')
|
||||
#active_list: DS.belongsTo('list', key: 'active_list')
|
||||
active_list: DS.belongsTo('list')
|
||||
@@ -13,3 +13,4 @@ Qsupplier.App.Table = DS.Model.extend
|
||||
#active_list: (->
|
||||
#@get('list')
|
||||
#).property('list')
|
||||
occupied: (-> !!@get('active_list')).property('active_list.id')
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Qsupplier.App.ApplicationView = Ember.View.extend
|
||||
didInsertElement: ->
|
||||
Qsupplier.watch_events()
|
||||
selector_mappings =
|
||||
'.top-menu-root': '/'
|
||||
'.top-menu-lists': 'lists'
|
||||
|
||||
@@ -22,7 +22,7 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
|
||||
(@content.get('position_y') || 0) * @containerHeight() / section_height
|
||||
).property('content.section.height', 'content.position_y')
|
||||
|
||||
style: (->
|
||||
style: (->
|
||||
"position:absolute;width:83px;height:48px;left:#{@get('offsetX')}px;top:#{@get('offsetY')}px"
|
||||
).property('offsetX', 'offsetY')
|
||||
|
||||
@@ -48,11 +48,11 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
|
||||
@$el = @$()
|
||||
#@$('.table-actions').hide()
|
||||
#title = @$('.table-actions .title').clone()
|
||||
content = @$('.table-actions')
|
||||
@$('.table-actions').hide()
|
||||
#@$('.table-actions .title').remove()
|
||||
content.hide()
|
||||
@$el.on 'click', =>
|
||||
content.toggle() if @$el.hasClass('occupied') and not @get('controller.editmode')
|
||||
# duplication of .table-actions because variable gets unshadowed
|
||||
@$('.table-actions').toggle() if @$el.hasClass('occupied') and not @get('controller.editmode')
|
||||
#@$el.qtip
|
||||
#content:
|
||||
#text: content
|
||||
|
||||
@@ -2,7 +2,7 @@ root = exports ? this
|
||||
root.Qsupplier=
|
||||
watch_events: ->
|
||||
faye = new Faye.Client(event_host)
|
||||
faye.subscribe "/supplier/"+supplier_id, (e)=>
|
||||
faye.subscribe "/supplier/#{supplier_id}", (e)=>
|
||||
console.log "Event: #{e.event}"
|
||||
console.log e.data
|
||||
if(e.event == 'new_order')
|
||||
@@ -14,14 +14,17 @@ root.Qsupplier=
|
||||
# console.log "Ugly ember fix for adding order #{e.data.order.id} as relation to its list"
|
||||
list = order.get('list')
|
||||
list.get('orders').addRecord order
|
||||
if table = list.get('table')
|
||||
if table.get('active_list') isnt list
|
||||
table.set 'active_list', list
|
||||
, 200
|
||||
else if(e.event == 'list_needs_help')
|
||||
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
|
||||
list.markNeedsHelp()
|
||||
# old stuff
|
||||
$('#list-needs-help-indicator-'+e.data.id).removeClass('hide')
|
||||
$('#list-is-helped-button-'+e.data.id).removeClass('hide')
|
||||
$('.section-table-list-'+e.data.id).addClass('needs_help')
|
||||
# $('#list-needs-help-indicator-'+e.data.id).removeClass('hide')
|
||||
# $('#list-is-helped-button-'+e.data.id).removeClass('hide')
|
||||
# $('.section-table-list-'+e.data.id).addClass('needs_help')
|
||||
else if(e.event == 'list_needs_payment')
|
||||
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
|
||||
list.markNeedsPayment()
|
||||
@@ -34,7 +37,6 @@ root.Qsupplier=
|
||||
else if e.event == 'list_update'
|
||||
if Qsupplier.App
|
||||
list = Qsupplier.App.List.updateOrAdd(e.data.list)
|
||||
debugger
|
||||
else if e.event == 'list_closed'
|
||||
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
|
||||
list.markClosed()
|
||||
@@ -48,10 +50,10 @@ root.Qsupplier=
|
||||
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
|
||||
list.markHelped()
|
||||
|
||||
list_id = e.data.id
|
||||
$('#list-needs-help-indicator-'+list_id).addClass('hide')
|
||||
$('#list-is-helped-button-'+list_id).addClass('hide')
|
||||
$('.section-table-list-'+list_id).removeClass('needs_help')
|
||||
# list_id = e.data.id
|
||||
# $('#list-needs-help-indicator-'+list_id).addClass('hide')
|
||||
# $('#list-is-helped-button-'+list_id).addClass('hide')
|
||||
# $('.section-table-list-'+list_id).removeClass('needs_help')
|
||||
else if e.event == 'order_being_processed'
|
||||
if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
|
||||
order.markActive()
|
||||
|
||||
@@ -22,7 +22,7 @@ App.ApplicationSerializer = DS.ActiveModelSerializer.extend
|
||||
else
|
||||
@_super record, json, relationship
|
||||
|
||||
App.Store = DS.Store.extend
|
||||
App.ApplicationStore = DS.Store.extend
|
||||
adapter: DS.RESTAdapter.extend
|
||||
namespace: 'user'
|
||||
# user underscored paths
|
||||
|
||||
Reference in New Issue
Block a user