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. * THE SOFTWARE.
*/ */
body { body.client {
background: black; background: black;
font-family: FreeSans, Helvetica, Arial, sans-serif; font-family: FreeSans, Helvetica, Arial, sans-serif;
padding: 0; padding: 0;

View File

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

View File

@@ -51,7 +51,10 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
}; };
// Put some useful variables in the top level scope // Put some useful variables in the top level scope
$scope.page = { title: '' }; $scope.page = {
title: '',
bodyClassName: ''
};
$scope.currentUserID = null; $scope.currentUserID = null;
$scope.currentUserIsAdmin = false; $scope.currentUserIsAdmin = false;
$scope.currentUserHasUpdate = false; $scope.currentUserHasUpdate = false;
@@ -106,11 +109,15 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
keyboard.reset(); keyboard.reset();
}; };
// Update title upon navigation // Update title and CSS class upon navigation
$scope.$on('$routeChangeSuccess', function(event, current, previous) { $scope.$on('$routeChangeSuccess', function(event, current, previous) {
var title = current.$$route.title; var title = current.$$route.title;
if (title) if (title)
$scope.page.title = 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"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
<link rel="stylesheet" type="text/css" href="guacamole.css"> <link rel="stylesheet" type="text/css" href="guacamole.css">
</head> </head>
<body> <body ng-class="page.bodyClassName">
<div id="content" ng-view> <div id="content" ng-view>
</div> </div>