JSON api serializers for suppliers

This commit is contained in:
2015-09-09 19:11:46 +02:00
parent 5cdbe57dec
commit 968d042501
37 changed files with 86 additions and 133 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -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
@@ -1,27 +0,0 @@
.button-text
// Only icons for now
display: none
.active-orders-table
.status-icons
span
display: none
.active
.status-icons
.active-order
display: inline-block
.table-number-with-info
position: relative
.extra-list-info
// Facebook profiles
display: none
$extra-info-width: 220px
position: absolute
width: $extra-info-width
// 7px is padding + border, 5px is extra spacing
right: -$extra-info-width - 7px*2 - 5px
top: -7px*2
padding: 4px
border: 3px solid #aaa
border-radius: 3px
background-color: white
text-align: left
@@ -5,3 +5,4 @@ $wood: image-url('textures/theme1.jpg')
$background-brown: #57351f
$current-color: #fc3
$active-color: #fc3
$button-spacing: 8px
@@ -1,5 +1,4 @@
//= require qtip
//= require_directory ../base1-shared
//= require pickdate
//= require fullcalendar
// bourbon for animation
@@ -13,6 +12,7 @@
@import ./qdisplays
@import ./form_actions
@import ./components/*
@import ./resources/*
@import ./qsections
@import ./section_tab_headers
@import ./qlists
@@ -0,0 +1,3 @@
.button-text
// Only icons for now
display: none
@@ -1,44 +0,0 @@
//DEPRICATED
#product-category-list
list-style: none
li
clear: both
margin-bottom: 8px
.name
padding: 5px 5px
#week_days-group
display: inline-block
.week-day-toggle
margin: 0
&.active
// nothing for now
&.inactive
opacity: 0.4
#full_day-controller
line-height: 34px
vertical-align: top
// height: 34px
display: inline-block
span
@extend .fa
@extend .fa-clock-o
margin: 0 10px
color: #444
&.active
span
color: #f70
#sub-day-container
display: inline-block
vertical-align: top
&.hide
display: none
select
width: 70px
margin-right: 14px
margin-bottom: 0
.product-category-visible-never
@extend .fa
@extend .fa-times
.product-category-visible-always
@extend .fa
@extend .fa-circle-o-notch
@@ -1,19 +0,0 @@
.products_preview-date
.products_preview-time-container
float: left
input
width: 120px
.products_preview-hour
float: left
margin-left: 10px
select
width: 70px
&:after
content: " :"
.products_preview-minute
float: left
margin-left: 10px
select
width: 70px
#products-table
width: 100%
@@ -1,4 +1,9 @@
$button-spacing: 8px
.active-orders-table
.status-icons
.active-order
@extend .fa
@extend .fa-check
@extend .fa-lg
.dashboard-lists-header, .dashboard-orders-header
cursor: pointer
.icon
@@ -36,3 +41,20 @@ $button-spacing: 8px
span
@extend .fa
@extend .fa-list-alt
.table-number-with-info
position: relative
.extra-list-info
// Facebook profiles
display: none
$extra-info-width: 220px
position: absolute
width: $extra-info-width
// 7px is padding + border, 5px is extra spacing
right: -$extra-info-width - 7px*2 - 5px
top: -7px*2
padding: 4px
border: 3px solid #aaa
border-radius: 3px
background-color: white
text-align: left