2014-05-31 04:07:15 +04:00
|
|
|
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});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-09 15:02:51 +04:00
|
|
|
var popoverInitializer = {
|
2014-05-31 04:07:15 +04:00
|
|
|
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');
|
2014-06-06 08:04:49 +04:00
|
|
|
application.inject('controller:modals.delete-post', 'popover', 'popover:service');
|
2014-06-19 23:44:44 +04:00
|
|
|
application.inject('route:application', 'popover', 'popover:service');
|
2014-05-31 04:07:15 +04:00
|
|
|
}
|
2014-06-06 08:04:49 +04:00
|
|
|
};
|
2014-06-09 15:02:51 +04:00
|
|
|
|
|
|
|
export default popoverInitializer;
|