bootstrap-for-ember icon indicating copy to clipboard operation
bootstrap-for-ember copied to clipboard

Using nested model's property as tab title

Open lperichon opened this issue 11 years ago • 2 comments

Hi! Im trying to use bs-tabs by iterating over a hasMany and using an attribute on the nested model as title for the tab.

This is what I could come up with on the controller:

var PracticesShowController = Ember.ObjectController.extend({ practicePartTabs: function() { return this.get('practiceParts').map( function(practicePart){ return Ember.Object.create({ title: practicePart.get('part').get('symbol'), template: 'practices/practice-part-tab-pane'}); }); }.property('practiceParts') });

My associations are set like this: practice ->* practicePart -> part

On the practice show template I can access everything just fine.

The problem is that in the controller practicePart.get('part') does not populate the properties, im guessing it has to do with the promise concept, but im very new at Ember so I have no clue how to get this working!

I hope you can help me!

lperichon avatar Apr 10 '14 20:04 lperichon

@lperichon Do u mind providing a jsbin with the problem so I can help further?

Thanks

asaf avatar Apr 15 '14 10:04 asaf

Hi Asaf! Thank you for your help :) I tried to isolate the code into an executable jsbin, but I cant seem to get it. I am new to ember and i'm using ember app kit, so everything is distributed in many files. Would it be the same for you to look at the code? https://github.com/lperichon/sadhana-cli If you look at https://github.com/lperichon/sadhana-cli/blob/master/app/templates/practices/show.hbs you can see where i try to use the bs-tabs component. binding it to the practicePartTabs property defined on the practices show controller (https://github.com/lperichon/sadhana-cli/blob/master/app/controllers/practices/show.js)

lperichon avatar Apr 16 '14 14:04 lperichon