CRM-20929 - Convey css classes to main page title from Angular
authorColeman Watts <coleman@civicrm.org>
Thu, 20 Jul 2017 13:58:36 +0000 (09:58 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 20 Jul 2017 13:58:36 +0000 (09:58 -0400)
ang/crmUi.js

index d3ea3a469c6f3f2efdb7c9e1bc31928089e01234..985edc291c32b8117e7d946f43c63e4b2a0e06e9 100644 (file)
         scope: {
           crmDocumentTitle: '='
         },
+        limit: 'ae',
         link: function(scope, $el, attrs) {
           function update() {
             $timeout(function() {
               var newPageTitle = _.trim($el.html()),
-                newDocumentTitle = scope.crmDocumentTitle || $el.text();
+                newDocumentTitle = scope.crmDocumentTitle || $el.text(),
+                cls = $el.attr('class').split(' '),
+                classes = _.filter(cls, function(c) {
+                  return c.indexOf('ng-') !== 0;
+                });
+              classes.push('crm-page-title');
               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) {
-                  $(this).html(newPageTitle);
+                  $(this).addClass(classes.join(' ')).html(newPageTitle);
                   $el.hide();
                 }
               });