GUAC-919: Add page-specific CSS class support. Use client-specific body style.

This commit is contained in:
Michael Jumper
2014-11-04 21:24:16 -08:00
parent 0542146e8e
commit 04ce36f335
4 changed files with 15 additions and 4 deletions

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
body {
body.client {
background: black;
font-family: FreeSans, Helvetica, Arial, sans-serif;
padding: 0;

View File

@@ -32,20 +32,24 @@ angular.module('index').config(['$routeProvider', '$locationProvider',
$routeProvider.
when('/', {
title: 'application.title',
bodyClassName: 'home',
templateUrl: 'app/home/templates/home.html',
controller: 'homeController'
}).
when('/manage/', {
title: 'application.title',
bodyClassName: 'manage',
templateUrl: 'app/manage/templates/manage.html',
controller: 'manageController'
}).
when('/login/', {
title: 'application.title',
bodyClassName: 'login',
templateUrl: 'app/login/templates/login.html',
controller: 'loginController'
}).
when('/client/:type/:id/:params?', {
bodyClassName: 'client',
templateUrl: 'app/client/templates/client.html',
controller: 'clientController'
}).

View File

@@ -51,7 +51,10 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
};
// Put some useful variables in the top level scope
$scope.page = { title: '' };
$scope.page = {
title: '',
bodyClassName: ''
};
$scope.currentUserID = null;
$scope.currentUserIsAdmin = false;
$scope.currentUserHasUpdate = false;
@@ -106,11 +109,15 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
keyboard.reset();
};
// Update title upon navigation
// Update title and CSS class upon navigation
$scope.$on('$routeChangeSuccess', function(event, current, previous) {
var title = current.$$route.title;
if (title)
$scope.page.title = title;
$scope.page.bodyClassName = current.$$route.bodyClassName || '';
});
}]);

View File

@@ -29,7 +29,7 @@ THE SOFTWARE.
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link rel="stylesheet" type="text/css" href="guacamole.css">
</head>
<body>
<body ng-class="page.bodyClassName">
<div id="content" ng-view>
</div>