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
|
|
|
tabsManager: Ember.computed(function () {
|
|
|
|
return this.nearestWithProperty('isTabsManager');
|
|
|
|
}),
|
|
|
|
|
|
|
|
active: Ember.computed('tabsManager.activeTab', function () {
|
|
|
|
return this.get('tabsManager.activeTab') === this;
|
|
|
|
}),
|
|
|
|
|
2015-09-03 14:06:50 +03:00
|
|
|
index: Ember.computed('tabsManager.tabs.[]', function () {
|
2014-09-15 04:40:24 +04:00
|
|
|
return this.get('tabsManager.tabs').indexOf(this);
|
|
|
|
}),
|
|
|
|
|
|
|
|
// Select on click
|
|
|
|
click: function () {
|
|
|
|
this.get('tabsManager').select(this);
|
|
|
|
},
|
|
|
|
|
2015-06-13 17:34:09 +03:00
|
|
|
willRender: function () {
|
2015-06-03 05:56:42 +03:00
|
|
|
// register the tabs with the tab manager
|
2014-09-15 04:40:24 +04:00
|
|
|
this.get('tabsManager').registerTab(this);
|
2015-06-03 05:56:42 +03:00
|
|
|
},
|
2014-09-15 04:40:24 +04:00
|
|
|
|
2015-06-03 05:56:42 +03:00
|
|
|
willDestroyElement: function () {
|
|
|
|
// unregister the tabs with the tab manager
|
2014-09-15 04:40:24 +04:00
|
|
|
this.get('tabsManager').unregisterTab(this);
|
2015-06-03 05:56:42 +03:00
|
|
|
}
|
2014-09-15 04:40:24 +04:00
|
|
|
});
|