drupal-civicrm/sites/all/modules/civicrm/ang/crmStatusPage/StatusPageServices.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-01-14 15:10:16 +02:00
(function(angular, $, _) {
angular.module('statuspage')
.filter('trusted', function($sce){ return $sce.trustAsHtml; })
// Todo: abstract this into a generic crmUi directive?
.directive('statuspagePopupMenu', function($timeout) {
return {
templateUrl: '~/statuspage/SnoozeOptions.html',
transclude: true,
link: function(scope, element, attr) {
element.on('click', '.hush-menu-button', function() {
$timeout(function() {
$('ul', element).show().menu();
element.closest('h3').addClass('menuopen');
$('body').one('click', function() {
$('ul', element).menu('destroy').hide();
element.closest('h3').removeClass('menuopen');
});
});
});
// TODO: Is there a more "Angular" way to do this animation?
element.on('click', 'button:not(.hush-menu-button), li', function() {
$(this).closest('div.crm-status-item').slideUp();
});
}
};
});
})(angular, CRM.$, CRM._);