2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-08-19 14:55:40 +03:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// See gh-tabs-manager.js for use
|
2015-08-19 14:55:40 +03:00
|
|
|
export default Ember.Component.extend({
|
2014-09-15 04:40:24 +04:00
|
|
|
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'),
|
|
|
|
|
2015-06-13 17:34:09 +03:00
|
|
|
willRender: function () {
|
2015-06-03 05:56:42 +03:00
|
|
|
// Register with the tabs manager
|
2014-09-15 04:40:24 +04:00
|
|
|
this.get('tabsManager').registerTabPane(this);
|
2015-06-03 05:56:42 +03:00
|
|
|
},
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2015-06-03 05:56:42 +03:00
|
|
|
willDestroyElement: function () {
|
|
|
|
// Deregister with the tabs manager
|
2014-09-15 04:40:24 +04:00
|
|
|
this.get('tabsManager').unregisterTabPane(this);
|
2015-06-03 05:56:42 +03:00
|
|
|
}
|
2014-09-15 04:40:24 +04:00
|
|
|
});
|