From: Coleman Watts Date: Sun, 25 Oct 2015 15:36:35 +0000 (-0400) Subject: Set CMS page title from Angular X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=835fcb5ef5620f01bb8d9008e5565e716554f0b3;p=civicrm-core.git Set CMS page title from Angular --- diff --git a/ang/crmStatusPage/StatusPage.html b/ang/crmStatusPage/StatusPage.html index 9e5de8d4da..218d11767e 100644 --- a/ang/crmStatusPage/StatusPage.html +++ b/ang/crmStatusPage/StatusPage.html @@ -3,9 +3,7 @@
-
-

{{ts('Status Messages')}}

-
+

{{ts('CiviCRM System Status (%1)', {1: _.where(statuses, {is_visible: 1}).length})}}

{{ts('Hello')}} + .directive('crmUiTitle', function($timeout) { + return { + link: function(scope, $el, attrs) { + function update() { + $timeout(function() { + var newTitle = $el.html(); + document.title = $('title').html().replace(pageTitle, newTitle); + // If the CMS has already added title markup to the page, use it + $('h1').not('.crm-container h1').each(function() { + if (_.trim($(this).html()) === _.trim(pageTitle)) { + $(this).html(newTitle); + $el.hide(); + } + }); + pageTitle = newTitle; + }); + } + + scope.$watch(function() {return $el.html();}, update); + } + } + }) + .run(function($rootScope, $location) { /// Example: $rootScope.goto = function(path) {