<form name="crm-system-status" crm-ui-id-scope>
- <div>
- <h1>{{ts('Status Messages')}}</h1>
- </div>
+ <h1 crm-ui-title>{{ts('CiviCRM System Status (%1)', {1: _.where(statuses, {is_visible: 1}).length})}}</h1>
<div id="crm-status-list" crm-ui-tab-set>
<div
/// crmUi: Sundry UI helpers
(function (angular, $, _) {
- var uidCount = 0;
+ var uidCount = 0,
+ pageTitle = 'CiviCRM';
angular.module('crmUi', [])
}
};
})
+
+ // Sets the one and only page title - uses CMS title if available
+ // WARNING: Use only once per route!
+ // Example: <h1 crm-ui-title>{{ts('Hello')}}</h1>
+ .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: <button ng-click="goto('home')">Go home!</button>
$rootScope.goto = function(path) {