mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
71c358b638
No Issue - Switches to the newer style of dependency injection. - Instead of injection Controllers via "needs," use Ember.inject.controller(). - Get rid of initializers that were only injecting objects into various factories. Converts these objects into Ember.Service objects and declaratively inject them where needed via Ember.inject.service(). The added benefit to this is that it's no longer a mystery where these properties/methods come from and it's straightforward to inject them where needed.
20 lines
540 B
JavaScript
20 lines
540 B
JavaScript
import Ember from 'ember';
|
|
import DropdownMixin from 'ghost/mixins/dropdown-mixin';
|
|
|
|
export default Ember.Component.extend(DropdownMixin, {
|
|
tagName: 'button',
|
|
attributeBindings: 'role',
|
|
role: 'button',
|
|
|
|
// matches with the dropdown this button toggles
|
|
dropdownName: null,
|
|
|
|
dropdown: Ember.inject.service(),
|
|
|
|
// Notify dropdown service this dropdown should be toggled
|
|
click: function (event) {
|
|
this._super(event);
|
|
this.get('dropdown').toggleDropdown(this.get('dropdownName'), this);
|
|
}
|
|
});
|