CRM-13823 - Display hidden_until date on status page
[civicrm-core.git] / ang / crmStatusPage / StatusPageServices.js
CommitLineData
4d8e3559
NM
1(function(angular, $, _) {
2
c426a987
CW
3 angular.module('statuspage')
4 .filter('trusted', function($sce){ return $sce.trustAsHtml; })
4d8e3559 5
c426a987
CW
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 });
21a5de76
CW
27 // TODO: Is there a more "Angular" way to do this animation?
28 element.on('click', 'button:not(.hush-menu-button), li', function() {
29 $(this).closest('div.crm-status-item').slideUp();
30 })
c426a987
CW
31 }
32 };
33 });
4d8e3559
NM
34
35})(angular, CRM.$, CRM._);