diff --git a/static/js/app.js b/static/js/app.js index 48a9e1350..bc721d769 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -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 diff --git a/static/js/pages/build-view.js b/static/js/pages/build-view.js index 908a25bd9..27fe4afd7 100644 --- a/static/js/pages/build-view.js +++ b/static/js/pages/build-view.js @@ -4,7 +4,9 @@ */ angular.module('quayPages').config(['pages', function(pages) { pages.create('build-view', 'build-view.html', BuildViewCtrl, { - newLayout: true + newLayout: true, + title: 'Build {{ build.display_name }}', + description: 'Logs and status for build {{ build.display_name }}' }); }]); diff --git a/static/js/services/meta-service.js b/static/js/services/meta-service.js new file mode 100644 index 000000000..0cd84fc89 --- /dev/null +++ b/static/js/services/meta-service.js @@ -0,0 +1,58 @@ +/** + * Service which helps set the contents of the tags (and the