SearchKit - Improve field/operator/value selection UI
[civicrm-core.git] / ang / crmUi.js
index 16ef03f0ba84fe85a478872a635b9d1e4b47efb6..3f091914b2a88f6d874ba2faad6281b82b1b5ae0 100644 (file)
           else {
             $(element).prepend('<span class="icon ui-icon-' + attrs.crmIcon + '"></span> ');
           }
-          if ($(element).is('button')) {
+          // Add crm-* class to non-bootstrap buttons
+          if ($(element).is('button:not(.btn)')) {
             $(element).addClass('crm-button');
           }
         }
           function update() {
             $timeout(function() {
               var newPageTitle = _.trim($el.html()),
-                newDocumentTitle = scope.crmDocumentTitle || $el.text();
+                newDocumentTitle = scope.crmDocumentTitle || $el.text(),
+                h1Count = 0;
               document.title = $('title').text().replace(documentTitle, newDocumentTitle);
               // If the CMS has already added title markup to the page, use it
               $('h1').not('.crm-container h1').each(function() {
-                if (_.trim($(this).html()) === pageTitle) {
+                if ($(this).hasClass('crm-page-title') || _.trim($(this).html()) === pageTitle) {
                   $(this).addClass('crm-page-title').html(newPageTitle);
                   $el.hide();
+                  ++h1Count;
                 }
               });
+              if (!h1Count) {
+                $el.show();
+              }
               pageTitle = newPageTitle;
               documentTitle = newDocumentTitle;
             });