diff --git a/app/components/authentication/authentication.js b/app/components/authentication/authentication.js index 3f50114..a8d768e 100644 --- a/app/components/authentication/authentication.js +++ b/app/components/authentication/authentication.js @@ -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); diff --git a/app/components/config/config.js b/app/components/config/config.js index 3605587..d78f209 100644 --- a/app/components/config/config.js +++ b/app/components/config/config.js @@ -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); } };