Add user product info

This commit is contained in:
2014-04-22 18:42:02 +02:00
parent 821f59b761
commit ea498cb9c5
26 changed files with 1474 additions and 105 deletions
@@ -0,0 +1,5 @@
App.ModalInfoController = Ember.ObjectController.extend
actions:
close: ->
@get('model.cancel').call(@) if @get('model.cancel')
@send 'closeModal'
@@ -28,3 +28,7 @@ App.TableController = Ember.ObjectController.extend
@set 'join_request_sent', true # keeps the button deactivated
toggleProductCategory: (product_category)->
product_category.set 'collapsed', not product_category.get('collapsed')
showProductDescription: (product)->
@send 'openModal', 'modal_info', Ember.Object.create
title: product.get('name')
body: textile(product.get('description'))
@@ -2,5 +2,6 @@ attr = DS.attr
App.Product = DS.Model.extend
name: attr 'string'
price: attr 'number'
description: attr 'string'
product_category: DS.belongsTo('product_category')
product_orders: DS.hasMany('product_order')
@@ -6,6 +6,11 @@ ControllerExtensions = Ember.Mixin.create
if jqXHR.status == 401
App.__container__.lookup('route:application').unauthorized()
handler
showModal: (options={})->
$(document).foundation('reflow') # needed (stupid!!!)
@confirm_cancel = options.cancel
@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
needs: ['application']
@@ -47,13 +52,6 @@ Ember.Controller.reopen
##@set 'controllers.application.confirm.content', options.content if options.content
##$('#confirm-modal').foundation('reveal', 'open') # this kills the ember actions
##$('#confirm-modal').css('visibility', 'visible').show()
showModal: (options={})->
#this.container.lookup('view:modal', {title:'Test title'})
#debugger
$(document).foundation('reflow') # needed (stupid!!!)
@confirm_cancel = options.cancel
@set 'controllers.application.modal.title', options.title if options.title
@set 'controllers.application.modal.content', options.content if options.content
#$('#confirm-modal').foundation('reveal', 'open') #this kills the ember actions
#$('#confirm-modal').css('visibility', 'visible').show()
@@ -0,0 +1,5 @@
modal-dialog action="close"
h3.flush--top= title
p==body
hr
button{action 'close'}= t 'modal.info.close'
@@ -25,9 +25,16 @@
unless product_category.collapsed
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
else
span.no-product-description
a{action addProduct product}= product.name
span.right.currency=currency product.price
button.add-product-to-list{action addProduct product}
span
span.product-price.currency=currency product.price
.large-6.columns= render 'product_orders'
else
.large12
@@ -39,5 +46,8 @@
ul.product_category-products
each product in product_category.products
li
if product.description
button.show-product-description{action showProductDescription product}
span
span= product.name
span.right.currency=currency product.price
@@ -9,6 +9,7 @@
#= require translations
#= require js-routes
#= require_directory .
#= require textile-js
#= require_self
#
# (($) ->