0

I have the following code in an emblem.js template:

each line_items itemController=lineItem
  .line_item.row-fluid.popover_link id="line_item_#{unbound id}" click="lineItemSelected" class={selected ordered}
    .span8
      = product.name

      if notSingleItem
        span.quantity &nbsp X #{quantity}

A model:

App.LineItem = DS.Model.extend
  quantity: DS.attr 'number'

  #this is duplicated for a reason
  product_price: DS.attr 'number'

  order: DS.belongsTo 'Cluey.Order'
  product: DS.belongsTo 'Cluey.Product'

  total: Ember.computed ->
    @get('quantity') * @get('product_price')
  .property('quantity', 'product_price')

  notSingleItem: Ember.computed ->
    @get('quantity') != 1
  .property('quantity')

  div_id: Ember.computed ->
    "line_item_" + @get('id')
  .property()

  ordered: DS.attr 'boolean', { defaultValue: false }
  should_print: DS.attr 'boolean', { defaultValue: true }

Now, the class attributes are bound to the attributes on the LineItem model which has an attribute "ordered" which I have set to true for a test, but it just does not seem to display the class of ordered, even when this attribute is set to true.

MilkyWayJoe
  • 9,082
  • 2
  • 38
  • 53
l33z3r
  • 617
  • 5
  • 16
  • have you specified the `itemController` in the implementation of your `ArrayController`? – MilkyWayJoe May 08 '13 at 20:09
  • I am actually not using an array controller. I am calling render 'order' which uses an order model and an OrderController and then in the order template I am simply looping over the line_items property of order. Is this the problem? – l33z3r May 09 '13 at 08:50
  • Maybe. I believe you should use a combination of [`ArrayController`](http://emberjs.com/api/classes/Ember.ArrayController.html) and `ObjectController`, where the `ObjectController` implementation is the `itemController`, referenced in the `ArrayController`. – MilkyWayJoe May 09 '13 at 13:34

0 Answers0