mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
fb239054a0
follow up from #95 - converts components to use ember-cli-shims
35 lines
940 B
JavaScript
35 lines
940 B
JavaScript
import Component from 'ember-component';
|
|
import computed from 'ember-computed';
|
|
|
|
// See gh-tabs-manager.js for use
|
|
export default Component.extend({
|
|
tabsManager: computed(function () {
|
|
return this.nearestWithProperty('isTabsManager');
|
|
}),
|
|
|
|
active: computed('tabsManager.activeTab', function () {
|
|
return this.get('tabsManager.activeTab') === this;
|
|
}),
|
|
|
|
index: computed('tabsManager.tabs.[]', function () {
|
|
return this.get('tabsManager.tabs').indexOf(this);
|
|
}),
|
|
|
|
// Select on click
|
|
click() {
|
|
this.get('tabsManager').select(this);
|
|
},
|
|
|
|
willRender() {
|
|
this._super(...arguments);
|
|
// register the tabs with the tab manager
|
|
this.get('tabsManager').registerTab(this);
|
|
},
|
|
|
|
willDestroyElement() {
|
|
this._super(...arguments);
|
|
// unregister the tabs with the tab manager
|
|
this.get('tabsManager').unregisterTab(this);
|
|
}
|
|
});
|