Merge pull request #19761 from MegaphoneJon/financial-169
[civicrm-core.git] / ang / crmStatusPage / StatusPageServices.js
index 9a0c263b9615039ea4065a9c09f3df52558afffc..e895d8979caa77e01267cf254dc9d710abd343a8 100644 (file)
@@ -1,9 +1,31 @@
 (function(angular, $, _) {
 
-  angular.module('statuspage').filter('trusted', function($sce){ return $sce.trustAsHtml; });
+  angular.module('crmStatusPage')
+    .filter('trusted', function($sce){ return $sce.trustAsHtml; })
 
-  angular.module('statuspage').service('statuspageSeverityList', function() {
-    return ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'];
-  });
+    // Todo: abstract this into a generic crmUi directive?
+    .directive('statuspagePopupMenu', function($timeout) {
+      return {
+        templateUrl: '~/crmStatusPage/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._);