Always set login to default theme
Change-Id: Iee3bb9e8562a126cc1dca5084687cf3569f729e2
This commit is contained in:
parent
7b30a1ff45
commit
360da93f4f
@ -9,7 +9,9 @@ angular.module('bansho.authentication', [])
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('LoginController', ['$scope', '$rootScope', '$location', 'authService', 'configManager', function ($scope, $rootScope, $location, authService, configManager) {
|
||||
.controller('LoginController', ['$scope', '$rootScope', '$location', 'authService', 'configManager', 'themeManager', function ($scope, $rootScope, $location, authService, configManager, themeManager) {
|
||||
themeManager.setTheme(themeManager.THEMES.DEFAULT);
|
||||
|
||||
var login = function (credentials) {
|
||||
authService.login(credentials);
|
||||
};
|
||||
@ -66,7 +68,7 @@ angular.module('bansho.authentication', [])
|
||||
$http.defaults.headers.common['X-Auth-Token'] = session.sessionId;
|
||||
|
||||
configManager.fetchConfig(configManager.getDevelopmentConfig().useStoredConfig).then(function () {
|
||||
themeManager.setTheme();
|
||||
themeManager.setTheme(configManager.getTheme());
|
||||
$location.path('/view');
|
||||
}, function (message) {
|
||||
throw new Error(message);
|
||||
|
@ -5,11 +5,13 @@
|
||||
angular.module('bansho.config', [])
|
||||
.service('themeManager', ['$rootScope', 'configManager',
|
||||
function ($rootScope, configManager) {
|
||||
// Constants for theme colors
|
||||
var THEMES = {
|
||||
DARK: "dark",
|
||||
LIGHT: "light",
|
||||
DEFAULT: "dark"
|
||||
};
|
||||
this.THEMES = THEMES;
|
||||
|
||||
var setThemeClass = function (theme, saveConfig) {
|
||||
$rootScope.themeClass = 'color-scheme--' + theme;
|
||||
@ -25,12 +27,11 @@ angular.module('bansho.config', [])
|
||||
*
|
||||
* If configManager isn't loaded this will set default.
|
||||
*/
|
||||
this.setTheme = function () {
|
||||
var theme = configManager.getTheme();
|
||||
this.setTheme = function (theme) {
|
||||
if (theme) {
|
||||
setThemeClass(theme, false);
|
||||
} else {
|
||||
setThemeClass(THEMES.DARK, false);
|
||||
setThemeClass(THEMES.DEFAULT, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user