Passing spec for user product information

This commit is contained in:
2014-04-23 17:06:46 +02:00
parent ea498cb9c5
commit 546e4499ea
42 changed files with 190 additions and 482 deletions
@@ -58,7 +58,7 @@ App.ApplicationController = Ember.Controller.extend
if list.get('join_requests').toArray().length
@transitionToRoute 'join_requests'
callback.call(@) if callback
error = (emberError)=>
error = @ajaxError (emberError)=>
# if jqXHR.status == 404 officially, now assume close list on error
#@redirect_to 'index', message: 'the_list_has_been_closed'
console.log "Error: #{emberError.message}" if emberError.message
@@ -1,10 +1,11 @@
ControllerExtensions = Ember.Mixin.create
ajaxError: (callback)->
handler = (jqXHR, textStatus, errorThrown)=>
console.log "Error: #{textStatus}: #{errorThrown}"
callback.call(@, jqXHR)
if jqXHR.status == 401
handler = (emberError)=>
console.log "Error: status #{emberError.status}"
if emberError.status == 401
App.__container__.lookup('route:application').unauthorized()
else
callback.call(@, emberError)
handler
showModal: (options={})->
$(document).foundation('reflow') # needed (stupid!!!)
@@ -12,6 +13,7 @@ ControllerExtensions = Ember.Mixin.create
@set 'controllers.application.modal.title', options.title if options.title
@set 'controllers.application.modal.content', options.content if options.content
Ember.ArrayController.reopen ControllerExtensions
Ember.Controller.reopen ControllerExtensions
Ember.Controller.reopen
needs: ['application']
secured: (callback)->
@@ -14,6 +14,7 @@ App.ApplicationRoute = Ember.Route.extend
Qstorage.setItem('auth_token', '')
@controllerFor('application').set 'list', null
App.obtain_token(t('messages.unauthorized'))
@controllerFor('application').redirect_to 'index', message: 'unauthorized'
actions:
openModal: (modalName, model)->
@controllerFor(modalName).set('model', model)
@@ -59,20 +59,21 @@ header.top-menu
App.MenuItemListNeedsHelpView
App.MenuItemListNeedsPaymentView
section.extra-info
.supplier-info-row
.supplier-name= list.supplier.name
.table-number
|
= t 'models.table'
|
= list.table.number
.supplier-info-row
.counter.supplier-orders-placed-count
= list.supplier.orders_placed_count
span.orders-placed-count-icon
.counter.supplier-orders-in-process-count
= list.supplier.orders_in_process_count
span.orders-in-process-count-icon
if list
.supplier-info-row
.supplier-name= list.supplier.name
.table-number
|
= t 'models.table'
|
= list.table.number
.supplier-info-row
.counter.supplier-orders-placed-count
= list.supplier.orders_placed_count
span.orders-placed-count-icon
.counter.supplier-orders-in-process-count
= list.supplier.orders_in_process_count
span.orders-in-process-count-icon
aside.side-menu
ul
li
@@ -45,7 +45,7 @@
hr
ul.product_category-products
each product in product_category.products
li
li class="order-product-#{unbound product.id}"
if product.description
button.show-product-description{action showProductDescription product}
span