CRM-13823 - Use popup menu for snooze options
[civicrm-core.git] / ang / crmStatusPage / StatusPageServices.js
1 (function(angular, $, _) {
2
3 angular.module('statuspage')
4 .filter('trusted', function($sce){ return $sce.trustAsHtml; })
5
6 .service('statuspageSeverityList', function() {
7 return ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'];
8 })
9
10 // Todo: abstract this into a generic crmUi directive?
11 .directive('statuspagePopupMenu', function($timeout) {
12 return {
13 templateUrl: '~/statuspage/SnoozeOptions.html',
14 transclude: true,
15
16 link: function(scope, element, attr) {
17 element.on('click', '.hush-menu-button', function() {
18 $timeout(function() {
19 $('ul', element).show().menu();
20 element.closest('h3').addClass('menuopen');
21 $('body').one('click', function() {
22 $('ul', element).menu('destroy').hide();
23 element.closest('h3').removeClass('menuopen');
24 });
25 });
26 });
27 }
28 };
29 });
30
31 })(angular, CRM.$, CRM._);