JSON api serializers for suppliers
This commit is contained in:
@@ -3,3 +3,6 @@ App.DashboardActiveListComponent = Ember.Component.extend
|
||||
layoutName: 'dashboard/active-list'
|
||||
classNameBindings: ['classIdentifier']
|
||||
classIdentifier: Ember.computed 'list.id', -> "list-row-#{@get('list.id')}"
|
||||
actions:
|
||||
showList: (list)->
|
||||
@get('targetObject').transitionToRoute 'list', list
|
||||
|
||||
@@ -31,6 +31,3 @@ App.IndexController = Ember.Controller.extend
|
||||
actions:
|
||||
toggleDashboardLists: -> @set 'show_lists', !@get('show_lists')
|
||||
toggleDashboardOrders: ->@set 'show_orders', !@get('show_orders')
|
||||
|
||||
showList: (id)->
|
||||
@transitionToRoute 'list', id
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
attr = DS.attr
|
||||
App.Order = DS.Model.extend
|
||||
state: attr('string')
|
||||
list: DS.belongsTo('list')
|
||||
price: attr('number')
|
||||
section: DS.belongsTo('section')
|
||||
section_id: attr('string')
|
||||
product_orders: DS.hasMany('product_order')
|
||||
|
||||
list: DS.belongsTo('list', async: false)
|
||||
section: DS.belongsTo('section', async: false)
|
||||
product_orders: DS.hasMany('product_order', async: false)
|
||||
user: DS.belongsTo 'user', async: false
|
||||
|
||||
active: (-> @get('state') == 'active').property('state')
|
||||
delivered: (-> @get('state') == 'delivered').property('state')
|
||||
|
||||
@@ -6,8 +6,7 @@ App.User= DS.Model.extend
|
||||
avatar: attr('string')
|
||||
list: DS.belongsTo('list') # in ember scope not many to many (yet)
|
||||
join_requests: DS.hasMany('join_request')
|
||||
avatar_tag: (->
|
||||
return unless avatar = @get('avatar')
|
||||
avatar_tag: Ember.computed 'avatar', 'name', ->
|
||||
avatar = @get('avatar') || "#{$asset_path}/supplier/unknown-avatar.png"
|
||||
name = @get('name')
|
||||
"<img src='#{avatar}' alt='#{name}' title='#{name}' class='user-avatar-image #{@get('provider')}'>".htmlSafe()
|
||||
).property('avatar', 'name')
|
||||
"<img src='#{avatar}' alt='#{name}' title='#{name}' class='user-avatar-image #{@get('provider', '')}'>".htmlSafe()
|
||||
|
||||
@@ -17,7 +17,7 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
#@sections = @store.findAll 'section'
|
||||
#Ember.RSVP.all([@product_categories, @sections]).then (results)=>
|
||||
@supplier.reload().then =>
|
||||
@store.findAll('list', state: 'active') #.then (lists) -> lists.invoke('get', 'table')
|
||||
@store.query('list', state: 'active') #.then (lists) -> lists.invoke('get', 'table')
|
||||
#@lists = @store.peekAll 'list'
|
||||
# product_categories = controller.set 'product_categories', @store.peekAll('product_category')
|
||||
#@store.findAll 'order', state: 'active' included in list
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
td.user-info.show-for-large-up
|
||||
h3= list.users.length
|
||||
each list.users as |user|
|
||||
= user.avatar_tag
|
||||
= user.avatar_tag
|
||||
td.status-icons
|
||||
if list.needs_help
|
||||
span.icon.needs-help
|
||||
@@ -12,16 +11,7 @@ td.numeric.table_number= table-number-with-info list=list
|
||||
td.section_title: link-to 'section' list.table.section.id: span=list.table.section.title
|
||||
td.currency.total_list_amount=currency list.total
|
||||
td.actions
|
||||
/ if list.needs_help
|
||||
button.mark-list-as-helped-button{ action "markListAsHelped" list.id}
|
||||
span.fa-stack.fa-2x.fa-stack-sized
|
||||
i.fa.fa-bell.fa-stack-small
|
||||
i.fa.fa-ban.revoke
|
||||
/= view "mark-list-helped-button" content=list
|
||||
= button-mark-list-helped content=list
|
||||
= button-remove-list-needs-payment content=list
|
||||
/= view "remove-list-needs-payment" content=list
|
||||
/= view "close-list-button" content=list
|
||||
= button-close-list content=list
|
||||
|
||||
button.show-list.button{action "showList" list.id}: span
|
||||
button.show-list.button{action "showList" list}: span
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
td.user-info.show-for-large-up
|
||||
each order.list.users as |user|
|
||||
= user.avatar_tag
|
||||
td.user-info.show-for-large-up= order.user.avatar_tag
|
||||
td.status-icons
|
||||
if order.active
|
||||
span.active-order.fa.fa-check.fa-lg
|
||||
span.active-order
|
||||
td= order.display
|
||||
td.numeric.table_number= table-number-with-info list=order.list
|
||||
td.section_title= link-to 'section' order.list.table.section.id: span=order.list.table.section.title
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
th.actions
|
||||
tbody
|
||||
each active_lists as |list|
|
||||
tr
|
||||
td= list.users.length
|
||||
= dashboard-active-list list=list
|
||||
.page-header
|
||||
if active_orders.length
|
||||
|
||||
Reference in New Issue
Block a user