2014-10-25 01:09:50 +04:00
|
|
|
// See gh-tabs-manager.js for use
|
2014-09-15 04:40:24 +04:00
|
|
|
var TabPane = Ember.Component.extend({
|
|
|
|
classNameBindings: ['active'],
|
|
|
|
|
|
|
|
tabsManager: Ember.computed(function () {
|
|
|
|
return this.nearestWithProperty('isTabsManager');
|
|
|
|
}),
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
tab: Ember.computed('tabsManager.tabs.[]', 'tabsManager.tabPanes.[]', function () {
|
2014-09-15 04:40:24 +04:00
|
|
|
var index = this.get('tabsManager.tabPanes').indexOf(this),
|
|
|
|
tabs = this.get('tabsManager.tabs');
|
|
|
|
|
|
|
|
return tabs && tabs.objectAt(index);
|
|
|
|
}),
|
|
|
|
|
|
|
|
active: Ember.computed.alias('tab.active'),
|
|
|
|
|
|
|
|
// Register with the tabs manager
|
|
|
|
registerWithTabs: function () {
|
|
|
|
this.get('tabsManager').registerTabPane(this);
|
|
|
|
}.on('didInsertElement'),
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-09-15 04:40:24 +04:00
|
|
|
unregisterWithTabs: function () {
|
|
|
|
this.get('tabsManager').unregisterTabPane(this);
|
|
|
|
}.on('willDestroyElement')
|
|
|
|
});
|
|
|
|
|
|
|
|
export default TabPane;
|