Merge pull request #17738 from colemanw/upgradeLocales
[civicrm-core.git] / js / crm.drupal7.js
index 8dc539d5027927ac2505b432e85b3150be3499d7..8f172f23b9798ff9f57cd9a3d86ea8da227d361e 100644 (file)
@@ -1,14 +1,18 @@
-// http://civicrm.org/licensing
+// https://civicrm.org/licensing
 (function($) {
-  $(document)
-    .on('dialogopen', function(e) {
-      // D7 hack to get the toolbar out of the way (CRM-15341)
-      $('#toolbar').css('z-index', '100');
-    })
-    .on('dialogclose', function(e) {
-      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
-        // D7 hack, restore toolbar position (CRM-15341)
-        $('#toolbar').css('z-index', '');
+  "use strict";
+
+  $(document).on('crmLoad', '#civicrm-menu', hideMenuToggleButtonForNonAdminUsers);
+
+  /**
+   * Hides the Menu Toggle Button when the Admin Menu is not available for the user.
+   */
+  function hideMenuToggleButtonForNonAdminUsers() {
+    $(document).ready(function() {
+      if (!$('#toolbar').length) {
+        CRM.menubar.removeToggleButton();
       }
     });
+  }
+
 })(CRM.$);