Style upgrades and emberified supplier lists

This commit is contained in:
2014-04-24 16:41:08 +02:00
parent 546e4499ea
commit 27a1022eb4
56 changed files with 321 additions and 139 deletions
@@ -0,0 +1,4 @@
attr = DS.attr
Qsupplier.App.JoinRequest= DS.Model.extend
list: DS.belongsTo('list')
user: DS.belongsTo('user')
@@ -4,6 +4,7 @@ Qsupplier.App.List = DS.Model.extend
needs_help: attr 'boolean'
needs_payment: attr 'boolean'
user_requests_closing: attr('boolean')
users: DS.hasMany('user')
is_paid: attr 'boolean'
has_active_orders: attr 'boolean'
price: attr 'number'
@@ -28,6 +29,9 @@ Qsupplier.App.List = DS.Model.extend
@set 'needs_payment', true
markIsPaid: ->
@set 'needs_payment', false
total: (->
@get('orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
).property('orders.@each.total')
close: ->
@markClosed()
@@ -36,3 +40,4 @@ Qsupplier.App.List = DS.Model.extend
is_helped: ->
@markHelped()
$.post Routes.supplier_mark_list_as_helped_path(), list_id: @id
sorted_orders: (-> @get('orders').sortBy('created_at').reverseObjects()).property('orders.@each.isLoaded')
@@ -1,4 +1,6 @@
attr = DS.attr
Qsupplier.App.User= DS.Model.extend
uid: attr 'string'
#active_list: DS.belongsTo('list')
facebook_id: attr('string')
email: attr('string')
list: DS.belongsTo('list') # in ember scope not many to many (yet)
join_requests: DS.hasMany('join_request')