mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
1f608cf5ab
Ref#3603 - Popover Buttons now have an `open` class applied to them when their popover is open - The open class is removed from the popover button at the start of the popover's fadeout - Consolidated common code into popover-mixin
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import BodyEventListener from 'ghost/mixins/body-event-listener';
|
|
|
|
var PopoverService = Ember.Object.extend(Ember.Evented, BodyEventListener, {
|
|
bodyClick: function (event) {
|
|
/*jshint unused:false */
|
|
this.closePopovers();
|
|
},
|
|
closePopovers: function () {
|
|
this.trigger('close');
|
|
},
|
|
togglePopover: function (popoverName, popoverButton) {
|
|
this.trigger('toggle', {target: popoverName, button: popoverButton});
|
|
}
|
|
});
|
|
|
|
var popoverInitializer = {
|
|
name: 'popover',
|
|
|
|
initialize: function (container, application) {
|
|
application.register('popover:service', PopoverService);
|
|
|
|
application.inject('component:gh-popover', 'popover', 'popover:service');
|
|
application.inject('component:gh-popover-button', 'popover', 'popover:service');
|
|
application.inject('controller:modals.delete-post', 'popover', 'popover:service');
|
|
application.inject('controller:modals.transfer-owner', 'popover', 'popover:service');
|
|
application.inject('route:application', 'popover', 'popover:service');
|
|
}
|
|
};
|
|
|
|
export default popoverInitializer;
|