diff --git a/app/layout/header/header.controller.js b/app/layout/header/header.controller.js index 0b91bd843..ddee20b6f 100644 --- a/app/layout/header/header.controller.js +++ b/app/layout/header/header.controller.js @@ -3,49 +3,52 @@ angular.module('tc.layout').controller('HeaderController', HeaderController); - HeaderController.$inject = ['$window', '$state', '$stateParams', 'TcAuthService', 'CONSTANTS', '$log', '$rootScope', 'UserService', 'ProfileService']; + HeaderController.$inject = ['$state', 'TcAuthService', 'CONSTANTS', '$log', '$rootScope', 'UserService', 'ProfileService']; - function HeaderController($window, $state, $stateParams, TcAuthService, CONSTANTS, $log, $rootScope, UserService, ProfileService) { + function HeaderController($state, TcAuthService, CONSTANTS, $log, $rootScope, UserService, ProfileService) { var vm = this; vm.domain = CONSTANTS.domain; vm.login = TcAuthService.login; vm.logout = logout; + activate(); + + function activate() { + initHeaderProps('default'); + + // List of events that might force header update + angular.forEach([ + CONSTANTS.EVENT_USER_LOGGED_IN, + CONSTANTS.EVENT_USER_LOGGED_OUT, + ], function(event) { + $rootScope.$on(event, function() { + initHeaderProps(event); + }); + }); + } function initHeaderProps(event) { $log.debug(event + ' triggered header update.'); vm.isAuth = TcAuthService.isAuthenticated(); if (vm.isAuth) { vm.userHandle = UserService.getUserIdentity().handle; - ProfileService.getUserProfile(vm.userHandle).then(function(data) { + + ProfileService.getUserProfile(vm.userHandle) + .then(function(data) { vm.profile = data; - }) - .catch(function(resp) { + }) + .catch(function(err) { $log.error("Unable to get user data"); // todo handle error - }) + }); } } - // init props default - initHeaderProps('default'); function logout() { - TcAuthService.logout().then( - function() { - // success - $state.go('home'); - }); - }; - - // List of events that might force header update - angular.forEach([ - CONSTANTS.EVENT_USER_LOGGED_IN, - CONSTANTS.EVENT_USER_LOGGED_OUT, - ], function(event) { - $rootScope.$on(event, function() { - initHeaderProps(event); + TcAuthService.logout() + .then(function() { + $state.go('home'); }); - }); + }; } - })(); diff --git a/app/topcoder.constants.js b/app/topcoder.constants.js index 6174c4983..1a35240cf 100644 --- a/app/topcoder.constants.js +++ b/app/topcoder.constants.js @@ -1,7 +1,7 @@ angular.module("CONSTANTS", []) .constant("CONSTANTS", { - "API_URL": "https://api.topcoder-qa.com/v3.0.0-BETA", + "API_URL": "https://api.topcoder-dev.com/v3", "API_URL_V2": "https://api.topcoder-dev.com/v2", "ASSET_PREFIX": "", "auth0Callback": "https://api.topcoder-dev.com/pub/callback.html", diff --git a/assets/css/topcoder.scss b/assets/css/topcoder.scss index cfbab40ab..d6a5a9e95 100644 --- a/assets/css/topcoder.scss +++ b/assets/css/topcoder.scss @@ -14,12 +14,13 @@ html { body { @include source-sans-regular; background-color: $ui-page-gray; +} + +.notifications { @media screen and (min-device-width: 768px) { min-width: 768px; } -} -.notifications { .notifications-container { position: static; z-index: 0; @@ -34,6 +35,9 @@ body { .view-container { padding-bottom: 60px; min-height: 480px; + @media screen and (min-device-width: 768px) { + min-width: 768px; + } } .notifications {