Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Changed how title is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Levett committed Sep 2, 2016
1 parent 0442430 commit ca85e5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion uw-frame-components/js/app-config.js
Expand Up @@ -22,7 +22,7 @@ define(['angular'], function(angular) {
'shibbolethSessionURL' : null //'/Shibboleth.sso/Session.json'
})
.value('NAMES', {
'title' : 'App Name',
'title' : 'MyUW', //you can name your app whatever you want
'guestUserName' : 'guest',
'fname' : 'sample-fname'
})
Expand Down
31 changes: 21 additions & 10 deletions uw-frame-components/portal/main/controllers.js
Expand Up @@ -5,17 +5,22 @@ define(['angular','require'], function(angular, require) {

app.controller('PortalMainController', ['$localStorage', '$sessionStorage','$scope', '$rootScope', '$document', '$location', 'NAMES', 'MISC_URLS', 'APP_FLAGS','THEMES','miscService', function($localStorage, $sessionStorage, $scope, $rootScope, $document, $location, NAMES, MISC_URLS, APP_FLAGS,THEMES, miscService) {
var defaults = {
showKeywordsInMarketplace : false,
homeImg : "img/square.jpg",
profileImg: "img/terrace.jpg",
typeaheadSearch: false,
exampleWidgets: false,
layoutMode : 'list', //other option is 'widgets'
gravatarEmail : null,
useGravatar : false,
webPortletRender : false
layoutMode : 'list' //other option is 'widgets
};

function setTitle(){
var frameTitle = "";
if($rootScope.portal && $rootScope.portal.theme) {
frameTitle = $rootScope.portal.theme.title;
if(frameTitle !== NAMES.title && !APP_FLAGS.isWeb) {
frameTitle = " | " + frameTitle;
} else {
//since frame title equals the title in NAMES lets not duplicate it
frameTitle = "";
}
}
$document[0].title=NAMES.title + frameTitle;
}

//=====functions ======
var init = function(){
Expand All @@ -27,9 +32,15 @@ define(['angular','require'], function(angular, require) {
$scope.THEMES = THEMES.themes;

if(NAMES.title) {
$document[0].title=NAMES.title;
setTitle();
}

$rootScope.$watch('portal.theme', function(newValue, oldValue) {
if(newValue && newValue !== oldValue) {
setTitle();
}
});

//class for ng-view
$scope.routeClass = "route" + angular.lowercase($location.path().replace(new RegExp('/', 'g'), '-'));
}
Expand Down

0 comments on commit ca85e5b

Please sign in to comment.