2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2014-10-24 21:09:50 +00:00
|
|
|
// See gh-tabs-manager.js for use
|
2014-09-14 18:40:24 -06:00
|
|
|
var TabPane = Ember.Component.extend({
|
|
|
|
classNameBindings: ['active'],
|
|
|
|
|
|
|
|
tabsManager: Ember.computed(function () {
|
|
|
|
return this.nearestWithProperty('isTabsManager');
|
|
|
|
}),
|
|
|
|
|
2014-10-24 21:09:50 +00:00
|
|
|
tab: Ember.computed('tabsManager.tabs.[]', 'tabsManager.tabPanes.[]', function () {
|
2014-09-14 18:40:24 -06: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'),
|
|
|
|
|
2015-06-13 09:34:09 -05:00
|
|
|
willRender: function () {
|
2015-06-02 20:56:42 -06:00
|
|
|
// Register with the tabs manager
|
2014-09-14 18:40:24 -06:00
|
|
|
this.get('tabsManager').registerTabPane(this);
|
2015-06-02 20:56:42 -06:00
|
|
|
},
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2015-06-02 20:56:42 -06:00
|
|
|
willDestroyElement: function () {
|
|
|
|
// Deregister with the tabs manager
|
2014-09-14 18:40:24 -06:00
|
|
|
this.get('tabsManager').unregisterTabPane(this);
|
2015-06-02 20:56:42 -06:00
|
|
|
}
|
2014-09-14 18:40:24 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
export default TabPane;
|