| 1 | (function(angular, $, _) { |
| 2 | |
| 3 | angular.module('crmStatusPage') |
| 4 | .filter('trusted', function($sce){ return $sce.trustAsHtml; }) |
| 5 | |
| 6 | // Todo: abstract this into a generic crmUi directive? |
| 7 | .directive('statuspagePopupMenu', function($timeout) { |
| 8 | return { |
| 9 | templateUrl: '~/crmStatusPage/SnoozeOptions.html', |
| 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 | }); |
| 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(); |
| 26 | }); |
| 27 | } |
| 28 | }; |
| 29 | }); |
| 30 | |
| 31 | })(angular, CRM.$, CRM._); |