From 2dc426d461ac1c8a64a4a21adf15cc831259de21 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 8 Jan 2015 09:27:40 +0700 Subject: [PATCH 01/11] fix bug for languages icon --- src/main/webapp/assets/images/ic-navi.png | Bin 12579 -> 12511 bytes .../bubble-chart/bubble-chart.tem.html | 3 ++ .../modules/navigation/navigation.tem.html | 2 +- .../modules/translation/translation.ser.js | 2 +- .../modules/translation/translation.tem.html | 2 +- src/main/webapp/assets/sass/main.sass | 29 +++++++++++++++++- src/main/webapp/assets/sass/z-responsive.sass | 11 +++++-- 7 files changed, 43 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/assets/images/ic-navi.png b/src/main/webapp/assets/images/ic-navi.png index 6ea73754204d505cd4a747ae83b0d4d7a4a0c5dc..67535d41b01db554be1b25be8564d6c7d1fcf8a0 100644 GIT binary patch delta 182 zcmZ3SbU$%|C!@+nFLlPrcNmo>XEA0^-o>Opxtd8@-pJC@(9PJ~)WXHsz|hdu#L~^x z(#hG()yU1#%+lCovMrOW0#uC|4mBo|UoaWULCi76p=Po1$3jj`kF6ICL delta 210 zcmcbgxHxHoCu7D&FLlPrvlvq*XEAE>6!`jD`4?rTXXYj5OfFy&k+(3nG&VAGGBtHG zGBC3+G_6Hd&8J3MOa<7yQF$ zIC&|PfrgWziK&x;qq!kg15K0^ic5l0)2vb^7cvPGv|gXtnMKRff@5 Career Analytics. Open Source. Awesome! +
+ +
diff --git a/src/main/webapp/assets/modules/navigation/navigation.tem.html b/src/main/webapp/assets/modules/navigation/navigation.tem.html index d6768adce..951d6fd5a 100644 --- a/src/main/webapp/assets/modules/navigation/navigation.tem.html +++ b/src/main/webapp/assets/modules/navigation/navigation.tem.html @@ -10,7 +10,7 @@
  • - +
  • diff --git a/src/main/webapp/assets/modules/translation/translation.ser.js b/src/main/webapp/assets/modules/translation/translation.ser.js index f3171c38b..917b7260b 100644 --- a/src/main/webapp/assets/modules/translation/translation.ser.js +++ b/src/main/webapp/assets/modules/translation/translation.ser.js @@ -4,7 +4,7 @@ angular.module('Common').factory('translationService', function ($translate, uti var instance = { initialize: function ($scope) { scope = $scope; - $(".langKey").click(function () { + $(".langKey").on('click', function () { var nextLang = instance.getNextLanguage(); $translate.use(nextLang); utils.apply(); diff --git a/src/main/webapp/assets/modules/translation/translation.tem.html b/src/main/webapp/assets/modules/translation/translation.tem.html index c1eed81fd..722591c17 100644 --- a/src/main/webapp/assets/modules/translation/translation.tem.html +++ b/src/main/webapp/assets/modules/translation/translation.tem.html @@ -1,2 +1,2 @@ - + diff --git a/src/main/webapp/assets/sass/main.sass b/src/main/webapp/assets/sass/main.sass index 318ff2da0..bf87601ad 100644 --- a/src/main/webapp/assets/sass/main.sass +++ b/src/main/webapp/assets/sass/main.sass @@ -203,6 +203,33 @@ ul.setting-items /* -- style for Navi ---*/ .header-section padding-left: 65px +a.m-languages + background: url(../images/ic-navi.png) transparent left top no-repeat + width: 60px + height: 60px + margin: auto + z-index: 999 + cursor: pointer + display: block + +.languages-block + right: 0 + position: absolute + top: 10px + z-index: 999 + +.sub-page-header + .languages-block + right: 55px + +a.m-languages.vi + background-position: 13px -590px +a.m-languages.en + background-position: 9px -519px +a.m-languages.vi:hover + background-position: -61px -590px +a.m-languages.en:hover + background-position: -65px -519px .main-navi-block width: 0 @@ -228,7 +255,7 @@ ul.setting-items color: #636363 display: block cursor: pointer - padding-top: 18px + padding-top: 15px .navi-container clear: both padding-top: 70px diff --git a/src/main/webapp/assets/sass/z-responsive.sass b/src/main/webapp/assets/sass/z-responsive.sass index de6d8b5ae..d6714f19b 100644 --- a/src/main/webapp/assets/sass/z-responsive.sass +++ b/src/main/webapp/assets/sass/z-responsive.sass @@ -356,10 +356,17 @@ display: table-cell padding: 5px 10px text-align: center -@media (max-width: 440px) +@media (max-width: 480px) .logo-block img max-width: 55% !important padding-top: 8px + .navbar + .languages-block + display: none .sub-page-header .logo-block img - max-width: 85% !important \ No newline at end of file + max-width: 85% !important + + .navi-container + .languages-block + display: block !important \ No newline at end of file From 0e6284025cc9d1356f565e61529a039d15a17682 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 09:43:16 +0700 Subject: [PATCH 02/11] Fix Asyn call in userService --- src/main/webapp/assets/modules/common/user.ser.js | 2 +- src/main/webapp/assets/modules/signin/signin.ser.js | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/assets/modules/common/user.ser.js b/src/main/webapp/assets/modules/common/user.ser.js index 9341737f8..2af620a62 100644 --- a/src/main/webapp/assets/modules/common/user.ser.js +++ b/src/main/webapp/assets/modules/common/user.ser.js @@ -9,6 +9,7 @@ angular.module("Common").factory("userService", function (jsonValue, utils, conn getUserInfo: function () { var deferred = $q.defer(); + defers.getUserInfo.push(deferred); //TODO: check actual user logged-in if ($rootScope.userInfo === undefined) { connectionFactory.findUserInfoByKey(); @@ -17,7 +18,6 @@ angular.module("Common").factory("userService", function (jsonValue, utils, conn $.each(defers.getUserInfo, function (i, d) {d.resolve($rootScope.userInfo);}); defers.getUserInfo.length = 0; } - defers.getUserInfo.push(deferred); return deferred.promise; }, diff --git a/src/main/webapp/assets/modules/signin/signin.ser.js b/src/main/webapp/assets/modules/signin/signin.ser.js index c02905c12..60a91ff56 100644 --- a/src/main/webapp/assets/modules/signin/signin.ser.js +++ b/src/main/webapp/assets/modules/signin/signin.ser.js @@ -10,10 +10,6 @@ angular.module('SignIn').factory('signInService', loginFailed: function () { // TODO: consider to use a "signing box" utils.sendNotification(jsonValue.notifications.hideLoadingBox); - }, - - loginSuccess: function() { - } } @@ -55,7 +51,6 @@ angular.module('SignIn').factory('signInService', }, openOathDialog: function (auth) { - console.log($(window).height()) if (auth.isNotSupported) {return alert("Sign-in by " + auth.provider.toUpperCase() + " isn't supported");} utils.sendNotification(jsonValue.notifications.loading, $(window).height()); $auth.authenticate(auth.provider) @@ -70,7 +65,7 @@ angular.module('SignIn').factory('signInService', } }; - utils.registerNotification(jsonValue.notifications.loginSuccess, $$.loginSuccess); + //utils.registerNotification(jsonValue.notifications.loginSuccess, $$.loginSuccess); utils.registerNotification(jsonValue.notifications.loginFailed, $$.loginFailed); return instance; }); \ No newline at end of file From f3905a3bf276b8fa6355f9fda26737a6ed68536f Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 09:51:58 +0700 Subject: [PATCH 03/11] Remove duplicate getUserInfo function --- src/main/webapp/assets/modules/app.js | 2 -- src/main/webapp/assets/modules/common/user.ser.js | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/assets/modules/app.js b/src/main/webapp/assets/modules/app.js index 5f00f4653..032719778 100644 --- a/src/main/webapp/assets/modules/app.js +++ b/src/main/webapp/assets/modules/app.js @@ -133,8 +133,6 @@ techlooper.run(function (shortcutFactory, connectionFactory, loadingBoxFactory, utils.apply(); return rsLocationPathFn; } - - userService.getUserInfo(); }); techlooper diff --git a/src/main/webapp/assets/modules/common/user.ser.js b/src/main/webapp/assets/modules/common/user.ser.js index 2af620a62..8f3e1e0f2 100644 --- a/src/main/webapp/assets/modules/common/user.ser.js +++ b/src/main/webapp/assets/modules/common/user.ser.js @@ -25,7 +25,8 @@ angular.module("Common").factory("userService", function (jsonValue, utils, conn return ($rootScope.userInfo === undefined); } } - instance.getUserInfo();//read userInfo + + instance.getUserInfo(); //handle refresh button: read user-info utils.registerNotification(jsonValue.notifications.userInfo, instance.getUserInfo); return instance; }); \ No newline at end of file From bc887ab2868bb8fced36e4348fa8364599628c47 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 10:07:58 +0700 Subject: [PATCH 04/11] Resovle confilct --- .../webapp/assets/modules/translation/translation.ser.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/webapp/assets/modules/translation/translation.ser.js b/src/main/webapp/assets/modules/translation/translation.ser.js index be195d5da..af19e5ec0 100644 --- a/src/main/webapp/assets/modules/translation/translation.ser.js +++ b/src/main/webapp/assets/modules/translation/translation.ser.js @@ -4,15 +4,9 @@ angular.module('Common').factory('translationService', function ($translate, uti var instance = { initialize: function ($scope) { scope = $scope; -<<<<<<< HEAD - $(".langKey").on('click', function () { - var nextLang = instance.getNextLanguage(); - $translate.use(nextLang); -======= $(".langKey").click(function () { var lang = instance.getNextLanguage(); $translate.use(lang).then(function () {utils.sendNotification(jsonValue.notifications.changeLang, lang);}); ->>>>>>> 56adb09f4f6fd3d0cd757892496c5f28dc1e1e8a utils.apply(); var nextLang = instance.getNextLanguage(lang); From 5bda35a3a7c1ecef653b1d00e2d4f3e97fe0f3d3 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 10:24:41 +0700 Subject: [PATCH 05/11] Support 2 language menus --- .../assets/modules/translation/translation.con.js | 2 +- .../assets/modules/translation/translation.ser.js | 10 +++------- .../assets/modules/translation/translation.tem.html | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/webapp/assets/modules/translation/translation.con.js b/src/main/webapp/assets/modules/translation/translation.con.js index baed632f0..2e5766d1f 100644 --- a/src/main/webapp/assets/modules/translation/translation.con.js +++ b/src/main/webapp/assets/modules/translation/translation.con.js @@ -1,4 +1,4 @@ -angular.module('Common').controller('translationController', function ($scope, translationService) { +angular.module('Common').controller('translationController', function ($scope, translationService, utils, $translate, jsonValue) { translationService.initialize($scope); $scope.icoLanguage = translationService.getNextLanguage(); }); diff --git a/src/main/webapp/assets/modules/translation/translation.ser.js b/src/main/webapp/assets/modules/translation/translation.ser.js index af19e5ec0..c6d6e7487 100644 --- a/src/main/webapp/assets/modules/translation/translation.ser.js +++ b/src/main/webapp/assets/modules/translation/translation.ser.js @@ -1,18 +1,14 @@ angular.module('Common').factory('translationService', function ($translate, utils, jsonValue) { var scope; - var instance = { initialize: function ($scope) { scope = $scope; - $(".langKey").click(function () { + scope.changeLanguage = function () { var lang = instance.getNextLanguage(); $translate.use(lang).then(function () {utils.sendNotification(jsonValue.notifications.changeLang, lang);}); utils.apply(); - - var nextLang = instance.getNextLanguage(lang); - scope.icoLanguage = nextLang; - scope.$apply(); - }); + scope.icoLanguage = instance.getNextLanguage(lang); + }; }, getNextLanguage: function (lang) { diff --git a/src/main/webapp/assets/modules/translation/translation.tem.html b/src/main/webapp/assets/modules/translation/translation.tem.html index 722591c17..8bc31c071 100644 --- a/src/main/webapp/assets/modules/translation/translation.tem.html +++ b/src/main/webapp/assets/modules/translation/translation.tem.html @@ -1,2 +1,2 @@ - + From ecb6636fa251f6b0ce901895380115000a5092ce Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 10:27:30 +0700 Subject: [PATCH 06/11] Remove utils.apply() because it not neccessary --- src/main/webapp/assets/modules/translation/translation.ser.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/webapp/assets/modules/translation/translation.ser.js b/src/main/webapp/assets/modules/translation/translation.ser.js index c6d6e7487..0e22d3d1b 100644 --- a/src/main/webapp/assets/modules/translation/translation.ser.js +++ b/src/main/webapp/assets/modules/translation/translation.ser.js @@ -6,7 +6,6 @@ angular.module('Common').factory('translationService', function ($translate, uti scope.changeLanguage = function () { var lang = instance.getNextLanguage(); $translate.use(lang).then(function () {utils.sendNotification(jsonValue.notifications.changeLang, lang);}); - utils.apply(); scope.icoLanguage = instance.getNextLanguage(lang); }; }, From 88b3f0cf1fb21895e7086838ec73a9e09c6f0f6d Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 8 Jan 2015 11:04:20 +0700 Subject: [PATCH 07/11] fix bug responssive --- .../webapp/assets/modules/chart/chart.con.js | 3 ++- .../assets/modules/job/searchForm.con.js | 1 + .../modules/navigation/navigation.ser.js | 25 ++++++++++++++----- .../assets/modules/register/register.con.js | 1 + .../assets/modules/signin/signin.con.js | 1 + .../skill-analytics/skill-analytics.con.js | 1 + src/main/webapp/assets/sass/main.sass | 12 +++------ src/main/webapp/assets/sass/z-responsive.sass | 17 +++---------- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/main/webapp/assets/modules/chart/chart.con.js b/src/main/webapp/assets/modules/chart/chart.con.js index dce1c6142..3bae3d862 100644 --- a/src/main/webapp/assets/modules/chart/chart.con.js +++ b/src/main/webapp/assets/modules/chart/chart.con.js @@ -1,4 +1,4 @@ -angular.module('Chart').controller('chartController', function ($scope, jsonValue, connectionFactory, utils, chartService) { +angular.module('Chart').controller('chartController', function ($scope, jsonValue, connectionFactory, utils, chartService, navigationService) { utils.sendNotification(jsonValue.notifications.switchScope, $scope); var events = jsonValue.events; @@ -14,4 +14,5 @@ angular.module('Chart').controller('chartController', function ($scope, jsonValu }); connectionFactory.receiveTechnicalTerms(); + navigationService.reSetingPositionLangIcon(); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modules/job/searchForm.con.js b/src/main/webapp/assets/modules/job/searchForm.con.js index 16299c9e2..f6a96c1d9 100644 --- a/src/main/webapp/assets/modules/job/searchForm.con.js +++ b/src/main/webapp/assets/modules/job/searchForm.con.js @@ -15,4 +15,5 @@ angular.module('Jobs').controller('searchFormController', function (utils, $scop animationFactory.animatePage(); navigationService.addSpaceforNavi(); + navigationService.reSetingPositionLangIcon(); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modules/navigation/navigation.ser.js b/src/main/webapp/assets/modules/navigation/navigation.ser.js index 22a966b79..5351626df 100644 --- a/src/main/webapp/assets/modules/navigation/navigation.ser.js +++ b/src/main/webapp/assets/modules/navigation/navigation.ser.js @@ -104,7 +104,7 @@ angular.module("Navigation").factory("navigationService", function (utils, jsonV var menuItem = $('.navi-container').find('li'); menuItem.on('click', function(){ //utils.hideNavigationBar(); - if($(this).find('a').hasClass('m-chart') || $(this).find('a').hasClass('m-search-jobs') || $(this).find('a').hasClass('sign-out-sign-in')){ + if(!$(this).find('a').hasClass('m-languages')){ menuItem.removeClass('active'); $(this).addClass('active'); if($(this).find('a').hasClass('m-search-jobs')){ @@ -117,6 +117,12 @@ angular.module("Navigation").factory("navigationService", function (utils, jsonV $('.navi-container').find('a.sign-out-sign-in').parent().removeClass('active'); $('.navi-container').find('a.m-chart').parent().addClass('active'); } + $('.techlooper-body').animate({ + 'padding-left': '85px' + }); + $('.sub-page-header').animate({ + 'padding-left': '20px' + }); } }); } @@ -129,11 +135,11 @@ angular.module("Navigation").factory("navigationService", function (utils, jsonV $$.naviControl(); }, - restartTour: function () { - $('.infor-tour').on('click', function () { - tourService.restart(); - }); - }, + //restartTour: function () { + // $('.infor-tour').on('click', function () { + // tourService.restart(); + // }); + //}, addSpaceforNavi: function(){ var page = $('.techlooper-body'); if($('.main-navi-block').width() == 85){ @@ -143,6 +149,13 @@ angular.module("Navigation").factory("navigationService", function (utils, jsonV page.css('padding-left', '0'); $('.sub-page-header').css('padding-left', '90px'); } + }, + reSetingPositionLangIcon: function(){ + if($('.navbar').length > 0){ + $('.languages-block').css('right','0'); + }else{ + $('.languages-block').css('right','55px'); + } } } diff --git a/src/main/webapp/assets/modules/register/register.con.js b/src/main/webapp/assets/modules/register/register.con.js index 3981be78d..8be5d8415 100644 --- a/src/main/webapp/assets/modules/register/register.con.js +++ b/src/main/webapp/assets/modules/register/register.con.js @@ -9,4 +9,5 @@ angular.module('Register').controller('registerController', utils.sendNotification(jsonValue.notifications.gotData); }); navigationService.addSpaceforNavi(); + navigationService.reSetingPositionLangIcon(); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modules/signin/signin.con.js b/src/main/webapp/assets/modules/signin/signin.con.js index 17cf85b33..e72db49e6 100644 --- a/src/main/webapp/assets/modules/signin/signin.con.js +++ b/src/main/webapp/assets/modules/signin/signin.con.js @@ -5,4 +5,5 @@ angular.module('SignIn').controller('signInController', function ($location, jso //utils.sendNotification(jsonValue.notifications.gotData); $scope.openOathDialog = signInService.openOathDialog; navigationService.addSpaceforNavi(); + navigationService.reSetingPositionLangIcon(); }); \ No newline at end of file diff --git a/src/main/webapp/assets/modules/skill-analytics/skill-analytics.con.js b/src/main/webapp/assets/modules/skill-analytics/skill-analytics.con.js index 8cc9bd391..a65136ef7 100644 --- a/src/main/webapp/assets/modules/skill-analytics/skill-analytics.con.js +++ b/src/main/webapp/assets/modules/skill-analytics/skill-analytics.con.js @@ -23,4 +23,5 @@ angular.module('Skill').controller('skillAnalyticsController', connectionFactory.analyticsSkill(skillStatisticRequest); //animationFactory.animatePage(); navigationService.addSpaceforNavi(); + navigationService.reSetingPositionLangIcon(); }); diff --git a/src/main/webapp/assets/sass/main.sass b/src/main/webapp/assets/sass/main.sass index 1d94c650d..976a5ccf8 100644 --- a/src/main/webapp/assets/sass/main.sass +++ b/src/main/webapp/assets/sass/main.sass @@ -213,15 +213,11 @@ a.m-languages display: block .languages-block - right: 0 + right: 55px position: absolute top: 10px z-index: 999 -.sub-page-header - .languages-block - right: 55px - a.m-languages.vi background-position: 13px -590px a.m-languages.en @@ -284,7 +280,7 @@ a.m-languages.en:hover a.m-bubble-chart background-position: 8px -58px a.m-search-jobs - background-position: 8px -198px + background-position: 8px -187px a.m-languages.vi background-position: 15px -592px a.m-languages.en @@ -316,7 +312,7 @@ a.m-languages.en:hover a.m-bubble-chart:hover background-position: -65px -58px a.m-search-jobs:hover - background-position: -65px -198px + background-position: -65px -187px a.m-languages.vi:hover background-position: -59px -592px a.m-languages.en:hover @@ -337,7 +333,7 @@ a.m-languages.en:hover a.m-bubble-chart background-position: -65px -58px a.m-search-jobs - background-position: -65px -198px + background-position: -65px -187px a.m-languages.vi background-position: -59px -592px a.m-languages.en diff --git a/src/main/webapp/assets/sass/z-responsive.sass b/src/main/webapp/assets/sass/z-responsive.sass index db1d92a71..40df20332 100644 --- a/src/main/webapp/assets/sass/z-responsive.sass +++ b/src/main/webapp/assets/sass/z-responsive.sass @@ -1,4 +1,6 @@ @media (min-width: 320px) and (max-width: 768px) + .register-form-block .first + padding-bottom: 20px !important .desktop display: none .mobile @@ -271,20 +273,7 @@ bottom: 35px .signin-accounts .bg7 width: 80px - .register-container - .register-form-block - .col-md-6 - width: 50% - float: left - padding: 0 - h2 - padding-left: 10px - .col-md-6.first - padding-right: 10px - .col-md-12 - padding-right: 0 - .technical-skill ul li - min-width: inherit + .register-container padding-top: 10px .register-form-block From e4fa46a56a0c08b75e39e684fc0e75c6b5fd6b33 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 11:21:33 +0700 Subject: [PATCH 08/11] Support redirect to login page if user go to register but not authenticated --- .../techlooper/controller/UserController.java | 4 +- .../com/techlooper/model/SocialRequest.java | 3 ++ src/main/webapp/assets/modules/app.js | 1 - .../assets/modules/common/connection.fac.js | 43 ++++++++++++------- .../webapp/assets/modules/common/json.val.js | 3 +- .../webapp/assets/modules/common/user.ser.js | 15 ++++--- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/techlooper/controller/UserController.java b/src/main/java/com/techlooper/controller/UserController.java index 2a154565e..7858ee9ce 100644 --- a/src/main/java/com/techlooper/controller/UserController.java +++ b/src/main/java/com/techlooper/controller/UserController.java @@ -42,7 +42,9 @@ public List save(@RequestBody @Valid UserInfo userInfo, BindingResul @SendToUser("/queue/info") @MessageMapping("/user/findByKey") - public UserInfo getUserInfo(SocialRequest searchRequest/*, @DestinationVariable String username */) { + @ResponseBody + @RequestMapping(value = "/user/findByKey", method = RequestMethod.POST) + public UserInfo getUserInfo(@RequestBody @Valid SocialRequest searchRequest/*, @DestinationVariable String username */) { UserInfo userInfo = userService.findUserInfoByKey(searchRequest.getKey()); userInfo.getLoginSource(); return userInfo; diff --git a/src/main/java/com/techlooper/model/SocialRequest.java b/src/main/java/com/techlooper/model/SocialRequest.java index 68831295d..a319af666 100644 --- a/src/main/java/com/techlooper/model/SocialRequest.java +++ b/src/main/java/com/techlooper/model/SocialRequest.java @@ -1,10 +1,13 @@ package com.techlooper.model; +import javax.validation.constraints.NotNull; + /** * Created by phuonghqh on 12/12/14. */ public class SocialRequest { + @NotNull private String key; public String getKey() { diff --git a/src/main/webapp/assets/modules/app.js b/src/main/webapp/assets/modules/app.js index 032719778..81208840e 100644 --- a/src/main/webapp/assets/modules/app.js +++ b/src/main/webapp/assets/modules/app.js @@ -35,7 +35,6 @@ techlooper.config(["$routeProvider", "$translateProvider", "$authProvider", "loc switch (rejection.status) { case 403: case 401: - //utils.sendNotification(jsonValue.notifications.loginFailed); if (localStorageService.get(jsonValue.storage.back2Me) === true) { utils.sendNotification(jsonValue.notifications.loginFailed); } diff --git a/src/main/webapp/assets/modules/common/connection.fac.js b/src/main/webapp/assets/modules/common/connection.fac.js index 1e78802e1..8a64b6023 100644 --- a/src/main/webapp/assets/modules/common/connection.fac.js +++ b/src/main/webapp/assets/modules/common/connection.fac.js @@ -59,8 +59,9 @@ angular.module("Common").factory("connectionFactory", errorHandler: function (error) { if (error.headers !== undefined && error.headers.message.indexOf("AuthenticationCredentialsNotFoundException") >= 0) { localStorageService.set(jsonValue.storage.back2Me, "true"); - utils.sendNotification(jsonValue.notifications.loginFailed); + return utils.sendNotification(jsonValue.notifications.loginFailed); } + return utils.sendNotification(jsonValue.notifications.http404); } } @@ -91,23 +92,35 @@ angular.module("Common").factory("connectionFactory", }, findUserInfoByKey: function () { - if (!broadcastClient.connected) { - rootScopeCallbacks.push({ - fn: instance.findUserInfoByKey, - args: undefined + //HTTP version + $$.post(jsonValue.httpUri.getUserInfoByKey, {key: localStorageService.get(jsonValue.storage.key)}) + .then(function(userInfo) { + $rootScope.userInfo = userInfo; + utils.sendNotification(jsonValue.notifications.userInfo, userInfo); + }) + .catch(function() { + localStorageService.set(jsonValue.storage.back2Me, "true"); }); - return instance.connectSocket(); - } - var subscription = broadcastClient.subscribe(socketUri.subscribeUserInfo, function (response) { - var userInfo = JSON.parse(response.body); - $rootScope.userInfo = userInfo; - utils.sendNotification(jsonValue.notifications.userInfo, userInfo); - subscription.unsubscribe(); - }); - broadcastClient.send(socketUri.getUserInfoByKey, {}, - JSON.stringify({key: localStorageService.get(jsonValue.storage.key)})); + // Websocket version - for nginx which support websocket version + //if (!broadcastClient.connected) { + // rootScopeCallbacks.push({ + // fn: instance.findUserInfoByKey, + // args: undefined + // }); + // return instance.connectSocket(); + //} + // + //var subscription = broadcastClient.subscribe(socketUri.subscribeUserInfo, function (response) { + // var userInfo = JSON.parse(response.body); + // $rootScope.userInfo = userInfo; + // utils.sendNotification(jsonValue.notifications.userInfo, userInfo); + // subscription.unsubscribe(); + //}); + // + //broadcastClient.send(socketUri.getUserInfoByKey, {}, + // JSON.stringify({key: localStorageService.get(jsonValue.storage.key)})); }, /* @subscription */ diff --git a/src/main/webapp/assets/modules/common/json.val.js b/src/main/webapp/assets/modules/common/json.val.js index 1e7958998..9d1cce90d 100644 --- a/src/main/webapp/assets/modules/common/json.val.js +++ b/src/main/webapp/assets/modules/common/json.val.js @@ -170,7 +170,8 @@ angular.module("Common").constant("jsonValue", { userSave: "user/save", login: "login", logout: "logout", - verifyUserLogin: "user/verifyUserLogin" + verifyUserLogin: "user/verifyUserLogin", + getUserInfoByKey: "user/findByKey" }, socketUri: { diff --git a/src/main/webapp/assets/modules/common/user.ser.js b/src/main/webapp/assets/modules/common/user.ser.js index 8f3e1e0f2..223ae54cd 100644 --- a/src/main/webapp/assets/modules/common/user.ser.js +++ b/src/main/webapp/assets/modules/common/user.ser.js @@ -10,18 +10,23 @@ angular.module("Common").factory("userService", function (jsonValue, utils, conn getUserInfo: function () { var deferred = $q.defer(); defers.getUserInfo.push(deferred); - //TODO: check actual user logged-in - if ($rootScope.userInfo === undefined) { + + if (instance.notLoggedIn()) { connectionFactory.findUserInfoByKey(); } else { - $.each(defers.getUserInfo, function (i, d) {d.resolve($rootScope.userInfo);}); - defers.getUserInfo.length = 0; + instance.resolve("getUserInfo", $rootScope.userInfo); } return deferred.promise; }, - notLoggedIn: function() { + resolve: function (key, reply) { + $.each(defers[key], function (i, d) {d.resolve(reply);}); + defers[key].length = 0; + }, + + //TODO: check actual user logged-in + notLoggedIn: function () { return ($rootScope.userInfo === undefined); } } From 34a5d41b0d663a98fc47a9e51647a8642dcc6871 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 8 Jan 2015 11:36:39 +0700 Subject: [PATCH 09/11] fix bug style for search page --- src/main/webapp/assets/modules/common/shortcut.fac.js | 4 ++-- src/main/webapp/assets/modules/job/searchBox.ser.js | 10 +++------- .../webapp/assets/modules/navigation/navigation.ser.js | 5 +++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/webapp/assets/modules/common/shortcut.fac.js b/src/main/webapp/assets/modules/common/shortcut.fac.js index 7b988d45e..fcffc41a9 100644 --- a/src/main/webapp/assets/modules/common/shortcut.fac.js +++ b/src/main/webapp/assets/modules/common/shortcut.fac.js @@ -1,4 +1,4 @@ -angular.module("Common").factory("shortcutFactory", function (jsonValue, $location, $rootScope, historyFactory, utils) { +angular.module("Common").factory("shortcutFactory", function (jsonValue, $location, $rootScope, historyFactory, utils, navigationService) { var $$ = { goBack: function () { @@ -17,9 +17,9 @@ angular.module("Common").factory("shortcutFactory", function (jsonValue, $locati } $location.path(jsonValue.routerUris.jobsSearch); break; - default: $$.goBack(); + navigationService.restoreNaviStyle(); break; } }, diff --git a/src/main/webapp/assets/modules/job/searchBox.ser.js b/src/main/webapp/assets/modules/job/searchBox.ser.js index 302c4a184..af27be3ae 100644 --- a/src/main/webapp/assets/modules/job/searchBox.ser.js +++ b/src/main/webapp/assets/modules/job/searchBox.ser.js @@ -1,4 +1,4 @@ -angular.module("Jobs").factory("searchBoxService", function ($location, jsonValue, utils, $translate, shortcutFactory) { +angular.module("Jobs").factory("searchBoxService", function ($location, jsonValue, utils, $translate, shortcutFactory, navigationService) { var scope, searchText, textArray; var $$ = { @@ -102,18 +102,14 @@ angular.module("Jobs").factory("searchBoxService", function ($location, jsonValu shortcutFactory.trigger('esc'); var view = utils.getView(); if(view == jsonValue.views.pieChart || view == jsonValue.views.bubbleChart){ - $('.navi-container').find('a.m-chart').parent().addClass('active'); - $('.navi-container').find('a.m-search-jobs').parent().removeClass('active'); - $('.main-navi-block').css('background','url(images/line-h.png) #000 right top repeat-y'); + navigationService.restoreNaviStyle(); } }); $('.btn-logo').click(function () { shortcutFactory.trigger('esc'); var view = utils.getView(); if(view == jsonValue.views.pieChart || view == jsonValue.views.bubbleChart){ - $('.navi-container').find('a.m-chart').parent().addClass('active'); - $('.navi-container').find('a.m-search-jobs').parent().removeClass('active'); - $('.main-navi-block').css('background','url(images/line-h.png) #000 right top repeat-y'); + navigationService.restoreNaviStyle(); } }); diff --git a/src/main/webapp/assets/modules/navigation/navigation.ser.js b/src/main/webapp/assets/modules/navigation/navigation.ser.js index 5351626df..672de1601 100644 --- a/src/main/webapp/assets/modules/navigation/navigation.ser.js +++ b/src/main/webapp/assets/modules/navigation/navigation.ser.js @@ -156,6 +156,11 @@ angular.module("Navigation").factory("navigationService", function (utils, jsonV }else{ $('.languages-block').css('right','55px'); } + }, + restoreNaviStyle: function(){ + $('.navi-container').find('a.m-chart').parent().addClass('active'); + $('.navi-container').find('a.m-search-jobs').parent().removeClass('active'); + $('.main-navi-block').css('background','url(images/line-h.png) #000 right top repeat-y'); } } From 9c8f7b0d095d433705f263d390bdf21fdce9e659 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 11:39:06 +0700 Subject: [PATCH 10/11] Fix issue of register page --- src/main/webapp/assets/modules/common/connection.fac.js | 1 + src/main/webapp/assets/modules/common/router.ser.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/main/webapp/assets/modules/common/connection.fac.js b/src/main/webapp/assets/modules/common/connection.fac.js index 8a64b6023..1975ac785 100644 --- a/src/main/webapp/assets/modules/common/connection.fac.js +++ b/src/main/webapp/assets/modules/common/connection.fac.js @@ -100,6 +100,7 @@ angular.module("Common").factory("connectionFactory", }) .catch(function() { localStorageService.set(jsonValue.storage.back2Me, "true"); + utils.sendNotification(jsonValue.notifications.loginFailed); }); diff --git a/src/main/webapp/assets/modules/common/router.ser.js b/src/main/webapp/assets/modules/common/router.ser.js index 35ed00b99..dd4e85352 100644 --- a/src/main/webapp/assets/modules/common/router.ser.js +++ b/src/main/webapp/assets/modules/common/router.ser.js @@ -22,6 +22,12 @@ angular.module("Common").factory("routerService", function (jsonValue, utils, $l logoutSuccess: function() { $location.path("/"); + }, + + changeUrl: function() { + if (utils.getView() !== jsonValue.views.signIn) { + localStorageService.remove(jsonValue.storage.back2Me); + } } } @@ -29,6 +35,7 @@ angular.module("Common").factory("routerService", function (jsonValue, utils, $l utils.registerNotification(jsonValue.notifications.logoutSuccess, $$.logoutSuccess); utils.registerNotification(jsonValue.notifications.loginSuccess, $$.loginSuccess); utils.registerNotification(jsonValue.notifications.http404, $$.http404); + utils.registerNotification(jsonValue.notifications.changeUrl, $$.changeUrl); var instance = { initialize: function () {} From 95852c1e903e2e6c298ff7e8462fff68f449c085 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 8 Jan 2015 12:02:00 +0700 Subject: [PATCH 11/11] Fix double bubble chart --- .../webapp/assets/modules/bubble-chart/bubble-chart.fac.js | 1 + src/main/webapp/assets/modules/common/connection.fac.js | 4 ++-- src/main/webapp/assets/modules/common/json.val.js | 1 + src/main/webapp/assets/modules/register/register.ser.js | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/assets/modules/bubble-chart/bubble-chart.fac.js b/src/main/webapp/assets/modules/bubble-chart/bubble-chart.fac.js index be2a9609e..b18486399 100644 --- a/src/main/webapp/assets/modules/bubble-chart/bubble-chart.fac.js +++ b/src/main/webapp/assets/modules/bubble-chart/bubble-chart.fac.js @@ -280,6 +280,7 @@ angular.module('Bubble').factory('bubbleFactory', function (utils, jsonValue, $l var box = $$.getBox(size, size); var randomCircles = $$.getCircles(box); + $(".bubble-chart-container").find("svg.bubbleChart").remove(); //remove all bubble chart svg var svg = d3.select(".bubble-chart-container").append("svg") .attr({preserveAspectRatio: "xMidYMid", width: size, height: size, class: "bubbleChart"}) .attr("viewBox", function (d) {return ["0 0", size, size].join(" ")}); diff --git a/src/main/webapp/assets/modules/common/connection.fac.js b/src/main/webapp/assets/modules/common/connection.fac.js index 1975ac785..0e43399a4 100644 --- a/src/main/webapp/assets/modules/common/connection.fac.js +++ b/src/main/webapp/assets/modules/common/connection.fac.js @@ -99,8 +99,8 @@ angular.module("Common").factory("connectionFactory", utils.sendNotification(jsonValue.notifications.userInfo, userInfo); }) .catch(function() { - localStorageService.set(jsonValue.storage.back2Me, "true"); - utils.sendNotification(jsonValue.notifications.loginFailed); + //localStorageService.set(jsonValue.storage.back2Me, "true"); + utils.sendNotification(jsonValue.notifications.notUserInfo); }); diff --git a/src/main/webapp/assets/modules/common/json.val.js b/src/main/webapp/assets/modules/common/json.val.js index 9d1cce90d..9b6e29625 100644 --- a/src/main/webapp/assets/modules/common/json.val.js +++ b/src/main/webapp/assets/modules/common/json.val.js @@ -37,6 +37,7 @@ angular.module("Common").constant("jsonValue", { loginSuccess: "Login success", loginFailed: "Login failed", userInfo: "User info", + notUserInfo: "Not get User info", hideLoadingBox: "Hide loading box", http404: "HTTP code 404", logoutSuccess: "Logout success" diff --git a/src/main/webapp/assets/modules/register/register.ser.js b/src/main/webapp/assets/modules/register/register.ser.js index 7d59bf47c..ed5a31a16 100644 --- a/src/main/webapp/assets/modules/register/register.ser.js +++ b/src/main/webapp/assets/modules/register/register.ser.js @@ -51,7 +51,7 @@ angular.module('Register').factory('registerService', }, enableNotifications: function () { - return $(".register-contianer").is(":visible"); + return utils.getView() === jsonValue.views.register; } } @@ -95,7 +95,7 @@ angular.module('Register').factory('registerService', } }; - //utils.registerNotification(jsonValue.notifications.userInfo, instance.updateUserInfo, $$.enableNotifications); + utils.registerNotification(jsonValue.notifications.notUserInfo, function () {localStorageService.set(jsonValue.storage.back2Me, "true");}, $$.enableNotifications); utils.registerNotification(jsonValue.notifications.switchScope, $$.initialize, $$.enableNotifications); return instance; }); \ No newline at end of file