mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 18:52:05 +03:00
37fd17c084
Closes #2418, #2714 Ref #2446, #2565 - Added and injected `popover` service to globally control popovers - Added `gh-popover-button` component - Added `popover-mixin` for popover and popover-buttons to mixin - Added body-event-listener mixin for popover service to watch for body clicks with - Post settings and post save button both now use `gh-popover` - Added hacks to `ember-hacks.css` to make popovers work until ghost-ui consolidates functionality
25 lines
765 B
JavaScript
25 lines
765 B
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) {
|
|
this.trigger('toggle', {target: popoverName});
|
|
}
|
|
});
|
|
|
|
export default {
|
|
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');
|
|
}
|
|
}; |