Work In Progress: Dynamic titles and descriptions
This commit is contained in:
parent
ed46d37ea7
commit
7460541c89
3 changed files with 87 additions and 22 deletions
|
@ -206,8 +206,8 @@ if (window.__config && window.__config.SENTRY_PUBLIC_DSN) {
|
|||
}
|
||||
|
||||
// Run the application.
|
||||
quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanService', '$http', '$timeout', 'CookieService', 'Features', '$anchorScroll', 'UtilService',
|
||||
function($location, $rootScope, Restangular, UserService, PlanService, $http, $timeout, CookieService, Features, $anchorScroll, UtilService) {
|
||||
quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanService', '$http', '$timeout', 'CookieService', 'Features', '$anchorScroll', 'UtilService', 'MetaService',
|
||||
function($location, $rootScope, Restangular, UserService, PlanService, $http, $timeout, CookieService, Features, $anchorScroll, UtilService, MetaService) {
|
||||
|
||||
var title = window.__config['REGISTRY_TITLE'] || 'Quay.io';
|
||||
|
||||
|
@ -299,34 +299,39 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi
|
|||
});
|
||||
|
||||
$rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
|
||||
$rootScope.pageClass = '';
|
||||
$rootScope.current = current.$$route;
|
||||
$rootScope.currentPage = current;
|
||||
|
||||
$rootScope.pageClass = '';
|
||||
|
||||
if (!current.$$route) { return; }
|
||||
|
||||
if (current.$$route.title) {
|
||||
$rootScope.title = current.$$route.title;
|
||||
} else {
|
||||
$rootScope.title = title;
|
||||
}
|
||||
|
||||
if (current.$$route.pageClass) {
|
||||
$rootScope.pageClass = current.$$route.pageClass;
|
||||
}
|
||||
|
||||
$rootScope.pageClass = current.$$route.pageClass || '';
|
||||
$rootScope.newLayout = !!current.$$route.newLayout;
|
||||
|
||||
if (current.$$route.description) {
|
||||
$rootScope.description = current.$$route.description;
|
||||
} else {
|
||||
$rootScope.description = '';
|
||||
}
|
||||
|
||||
$rootScope.fixFooter = !!current.$$route.fixFooter;
|
||||
|
||||
MetaService.getInitialTitle(current, function(title) {
|
||||
$rootScope.title = title;
|
||||
});
|
||||
|
||||
MetaService.getInitialDescription(current, function(description) {
|
||||
$rootScope.description = description
|
||||
});
|
||||
|
||||
$anchorScroll();
|
||||
});
|
||||
|
||||
$rootScope.$on('$viewContentLoaded', function(event, current) {
|
||||
$rootScope.$on('$viewContentLoaded', function(event) {
|
||||
var current = $rootScope.currentPage;
|
||||
|
||||
MetaService.getTitle(current, function(title) {
|
||||
$rootScope.title = title;
|
||||
});
|
||||
|
||||
MetaService.getDescription(current, function(description) {
|
||||
$rootScope.description = description;
|
||||
});
|
||||
|
||||
var activeTab = $location.search()['tab'];
|
||||
|
||||
// Setup deep linking of tabs. This will change the search field of the URL whenever a tab
|
||||
|
|
Reference in a new issue