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
@@ -4,29 +4,33 @@ root.Qsupplier=
faye = new Faye.Client(event_host)
faye.subscribe "/supplier/"+supplier_id, (e)=>
if(e.event == 'new_order')
Qsupplier.App.Order.create(e.data.order)
# old stuff
body = $('#active-orders-table tbody')
order = new Order(e.data)
order = new Order(e.data.order)
if body.length
body.append @mustache('#active-order-template', order)
$('.section-table-list-'+order.list_id()).addClass('active_order')
else if(e.event == 'list_needs_help')
if list = Qsupplier.App.List.findCached(e.data.id)
list.set('needs_help', true)
# 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')
else if(e.event == 'list_needs_payment')
if list = Qsupplier.App.List.findCached(e.data.id)
list.set('needs_payment', true)
# old stuff
$('#list-needs-payment-indicator-'+e.data.id).removeClass('hide')
$('.section-table-list-'+e.data.id).addClass('needs_payment')
else if(e.event == 'list_added') # DEPRICATED now handled by list_update
list = new List(e.data)
$('#active-lists-table tbody').append @mustache('#active-list-template', list)
# Add classes to section table view
table = $('#section-table-'+list.table_id())
table.addClass('section-table-list-'+list.id())
table.addClass('occupied')
table.addClass('needs_help') if list.needs_help()
table.addClass('needs_payment') if list.needs_payment()
else if(e.event == 'list_is_paid')
if list = Qsupplier.App.List.findCached(e.data.id)
list.set('needs_payment', false)
else if e.event == 'list_update'
list = new List(e.data)
Qsupplier.App.List.updateOrCreate(e.data.list)
# old stuff
list = new List(e.data.list)
row = $('#list-row-'+list.id())
content = @mustache('#active-list-template', list)
if row.length then row.replaceWith(content) else $('#active-lists-table tbody').append(content)
@@ -38,11 +42,16 @@ root.Qsupplier=
table.addClass('needs_payment') if list.needs_payment()
table.addClass('active_order') if list.has_active_orders()
else if e.event == 'list_closed'
if list = Qsupplier.App.List.findCached(e.data.id)
list.set('table', null)
list.set('state', 'closed')
$('#list-row-'+e.data.id).remove()
$('.of-list-'+e.data.id).remove()
table_list_class = 'section-table-list-'+e.data.id
$('.'+table_list_class).removeClass('occupied needs_help needs_payment active_order').removeClass(table_list_class)
else if e.event == 'list_helped'
if list = Qsupplier.App.List.findCached(e.data.id)
list.set('needs_help', false)
list_id = e.data.id
$('#list-needs-help-indicator-'+list_id).addClass('hide')
$('#list-is-helped-button-'+list_id).addClass('hide')