Commit | Line | Data |
---|---|---|
4d8e3559 NM |
1 | (function(angular, $, _) { |
2 | ||
cd6afc75 | 3 | angular.module('crmStatusPage') |
c426a987 | 4 | .filter('trusted', function($sce){ return $sce.trustAsHtml; }) |
4d8e3559 | 5 | |
c426a987 CW |
6 | // Todo: abstract this into a generic crmUi directive? |
7 | .directive('statuspagePopupMenu', function($timeout) { | |
8 | return { | |
cd6afc75 | 9 | templateUrl: '~/crmStatusPage/SnoozeOptions.html', |
c426a987 CW |
10 | transclude: true, |
11 | ||
12 | link: function(scope, element, attr) { | |
13 | element.on('click', '.hush-menu-button', function() { | |
14 | $timeout(function() { | |
15 | $('ul', element).show().menu(); | |
16 | element.closest('h3').addClass('menuopen'); | |
17 | $('body').one('click', function() { | |
18 | $('ul', element).menu('destroy').hide(); | |
19 | element.closest('h3').removeClass('menuopen'); | |
20 | }); | |
21 | }); | |
22 | }); | |
21a5de76 CW |
23 | // TODO: Is there a more "Angular" way to do this animation? |
24 | element.on('click', 'button:not(.hush-menu-button), li', function() { | |
25 | $(this).closest('div.crm-status-item').slideUp(); | |
232785ea | 26 | }); |
c426a987 CW |
27 | } |
28 | }; | |
29 | }); | |
4d8e3559 NM |
30 | |
31 | })(angular, CRM.$, CRM._); |