2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-10-25 01:09:50 +04:00
|
|
|
// See gh-tabs-manager.js for use
|
2014-09-15 04:40:24 +04:00
|
|
|
var Tab = Ember.Component.extend({
|
|
|
|
tabsManager: Ember.computed(function () {
|
|
|
|
return this.nearestWithProperty('isTabsManager');
|
|
|
|
}),
|
|
|
|
|
|
|
|
active: Ember.computed('tabsManager.activeTab', function () {
|
|
|
|
return this.get('tabsManager.activeTab') === this;
|
|
|
|
}),
|
|
|
|
|
|
|
|
index: Ember.computed('tabsManager.tabs.@each', function () {
|
|
|
|
return this.get('tabsManager.tabs').indexOf(this);
|
|
|
|
}),
|
|
|
|
|
|
|
|
// Select on click
|
|
|
|
click: function () {
|
|
|
|
this.get('tabsManager').select(this);
|
|
|
|
},
|
|
|
|
|
|
|
|
// Registration methods
|
|
|
|
registerWithTabs: function () {
|
|
|
|
this.get('tabsManager').registerTab(this);
|
|
|
|
}.on('didInsertElement'),
|
|
|
|
|
|
|
|
unregisterWithTabs: function () {
|
|
|
|
this.get('tabsManager').unregisterTab(this);
|
|
|
|
}.on('willDestroyElement')
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Tab;
|