Files
mozo-backend/app/assets/javascripts/user/app/components/menu-product-component.js.coffee
T

15 lines
675 B
CoffeeScript

App.MenuProductComponent = Ember.Component.extend
tagName: 'li'
classNameBindings: ['specific_id']
specific_id: (-> "order-product-#{@get('product.id')}").property('product.id')
orderProducts: false
target: -> @get('parentView.targetObject')
actions:
addProduct: (product)->
if existing = @target().store.all('product_order').find((po)-> po.get('product') == product and not po.get('order'))
existing.increment()
else
@target().store.createRecord 'product_order', product: product, price: product.get('price')
showProductDescription: (product)->
@target().modal 'product_info', model: product, title: product.get('name')