From 9e670f5eb16bc754fa2a66f28634a8c041c8ffc4 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Tue, 13 Oct 2015 16:15:45 +0700 Subject: [PATCH 1/6] Remove JSESSIONID when doing logout --- .../com/techlooper/config/web/sec/SecurityConfiguration.java | 2 +- src/main/webapp/assets/modules/common/securityService.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/techlooper/config/web/sec/SecurityConfiguration.java b/src/main/java/com/techlooper/config/web/sec/SecurityConfiguration.java index f4f1b6b70..ae859d301 100644 --- a/src/main/java/com/techlooper/config/web/sec/SecurityConfiguration.java +++ b/src/main/java/com/techlooper/config/web/sec/SecurityConfiguration.java @@ -61,7 +61,7 @@ protected void configure(HttpSecurity http) throws Exception { http.headers().frameOptions().disable(); http.authorizeRequests() .and().formLogin().loginPage("/login").usernameParameter("us").passwordParameter("pwd").successHandler(getSuccessHandler()).failureHandler(getAuthenticationFailureHandler()) - .and().logout().logoutUrl("/logout").logoutSuccessHandler(getLogoutSuccessHandler()).invalidateHttpSession(true).deleteCookies("SESSION").permitAll() + .and().logout().logoutUrl("/logout").logoutSuccessHandler(getLogoutSuccessHandler()).invalidateHttpSession(true).deleteCookies("JSESSIONID").permitAll() .and().exceptionHandling().authenticationEntryPoint(exceptionHandler()); } diff --git a/src/main/webapp/assets/modules/common/securityService.js b/src/main/webapp/assets/modules/common/securityService.js index d099072d8..24e09f734 100644 --- a/src/main/webapp/assets/modules/common/securityService.js +++ b/src/main/webapp/assets/modules/common/securityService.js @@ -6,7 +6,6 @@ techlooper.factory("securityService", function (apiService, $route, $rootScope, logout: function () { apiService.logout() .success(function (data, status, headers, config) { - $.removeCookie("JSESSIONID"); $rootScope.userInfo = undefined; var roles = $rootScope.currentUiView.roles || []; if (roles.length > 0) { From b938f17c4a336f6d31bf66ca89b17d9dde00a48f Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Tue, 13 Oct 2015 18:06:16 +0700 Subject: [PATCH 2/6] fix bug responsive for submission list on the challenge details page --- .../contestDetailReviewSubmission.html | 3 +++ .../webapp/assets/sass/contest-detail.sass | 5 +++++ .../assets/sass/z-responsive-candidate.sass | 21 +++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html b/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html index f492abc04..10a846e63 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html @@ -11,14 +11,17 @@
diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index e9d3ccff3..a54efdcdd 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -460,6 +460,11 @@ border-bottom: 1px solid #fff width: 100% padding: 5px 0 + label + display: none + width: 100% + clear: both + font-weight: 400 .submitted-row:last-child border-bottom: 0 padding-bottom: 0 diff --git a/src/main/webapp/assets/sass/z-responsive-candidate.sass b/src/main/webapp/assets/sass/z-responsive-candidate.sass index 3778bd445..03e4a6410 100644 --- a/src/main/webapp/assets/sass/z-responsive-candidate.sass +++ b/src/main/webapp/assets/sass/z-responsive-candidate.sass @@ -1374,6 +1374,27 @@ padding: 7px 12px 3px 12px .review-block padding: 0 + .subject-col + width: 100% + clear: both + padding-bottom: 10px + .submission-link-col + width: 100% + clear: both + padding-bottom: 10px + .date-col + width: 100% + clear: both + text-align: left + .submitted-histories + .header-row + display: none + .body-row + .submitted-row + label + display: block + text-align: left + margin-bottom: 0 .feedback-block padding: 0 label From 7428554f41874e9442cf69d9bfd7cf58e9af0344 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Tue, 13 Oct 2015 18:11:38 +0700 Subject: [PATCH 3/6] fix bug for feedback popup --- .../modules/common/email/popupEmail.html | 2 +- .../common/email/popupEmailDirective.js | 24 ++++++++++++------- src/main/webapp/assets/sass/dashboard.sass | 5 ++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/assets/modules/common/email/popupEmail.html b/src/main/webapp/assets/modules/common/email/popupEmail.html index c60179f7a..351391b05 100644 --- a/src/main/webapp/assets/modules/common/email/popupEmail.html +++ b/src/main/webapp/assets/modules/common/email/popupEmail.html @@ -20,7 +20,7 @@
-
+

diff --git a/src/main/webapp/assets/modules/common/email/popupEmailDirective.js b/src/main/webapp/assets/modules/common/email/popupEmailDirective.js index b60daf6a6..47aaa04b5 100644 --- a/src/main/webapp/assets/modules/common/email/popupEmailDirective.js +++ b/src/main/webapp/assets/modules/common/email/popupEmailDirective.js @@ -7,19 +7,25 @@ techlooper.directive("popupEmail", function () { composeEmail: "=" }, link: function (scope, element, attr, ctrl) { - $('.summernote').summernote({ + scope.options = { + height: 150, + focus: true, + airMode: true, toolbar: [ - ['fontname', ['fontname']], - ['fontsize', ['fontsize']], - ['style', ['bold', 'italic', 'underline', 'clear']], - ['color', ['color']], - ['para', ['ul', 'ol', 'paragraph']], + ['edit',['undo','redo']], + ['headline', ['style']], + ['style', ['bold', 'italic', 'underline', 'superscript', 'subscript', 'strikethrough', 'clear']], + ['fontface', ['fontname']], + ['textsize', ['fontsize']], + ['fontclr', ['color']], + ['alignment', ['ul', 'ol', 'paragraph', 'lineheight']], ['height', ['height']], ['table', ['table']], - ['insert', ['link']], - ['misc', ['undo', 'redo', 'codeview', 'fullscreen']] + ['insert', ['link','hr']], + ['view', ['fullscreen', 'codeview']], + ['help', ['help']] ] - }); + }; } } }); \ No newline at end of file diff --git a/src/main/webapp/assets/sass/dashboard.sass b/src/main/webapp/assets/sass/dashboard.sass index e6ad6668a..4b4b2de61 100644 --- a/src/main/webapp/assets/sass/dashboard.sass +++ b/src/main/webapp/assets/sass/dashboard.sass @@ -10,6 +10,11 @@ border-radius: 0 box-shadow: inherit background-color: transparent + .note-editable + padding: 20px + height: 150px !important + ul + list-style: inherit !important .modal-body padding: 0 .mail-box From d0d934767ba7766db0b327900c62f39f9eb17c58 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Tue, 13 Oct 2015 18:21:53 +0700 Subject: [PATCH 4/6] fix bug display registrants tab for Author --- .../assets/modules/contest-detail/contestDetailController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index 709408877..1eb001a55 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -174,7 +174,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l .success(function (registrants) { $scope.registrants = registrants; $scope.sortByStartDate(); - if (param.a == "registrants") { + if (param.a == "registrants" && $scope.contestDetail.isAuthor) { $('.nav-tabs a[href=".registrants"]').tab('show'); } }).finally(function () { From 1440134cc1988d81f6196c63c641936a2e2f25e0 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Tue, 13 Oct 2015 18:23:25 +0700 Subject: [PATCH 5/6] Fix submission ask FB --- .../common/challenge/submissionChallenge.html | 2 +- .../common/challenge/submissionChallenge.js | 68 ++++++++++++++----- .../modules/contest-detail/contestDetail.html | 2 +- .../contest-detail/contestDetailController.js | 19 +++--- .../assets/modules/contests/contest-list.html | 2 +- .../modules/contests/contest.directive.js | 20 +++--- 6 files changed, 73 insertions(+), 40 deletions(-) diff --git a/src/main/webapp/assets/modules/common/challenge/submissionChallenge.html b/src/main/webapp/assets/modules/common/challenge/submissionChallenge.html index 2358e723e..73330fc39 100644 --- a/src/main/webapp/assets/modules/common/challenge/submissionChallenge.html +++ b/src/main/webapp/assets/modules/common/challenge/submissionChallenge.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js b/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js index b09bfce17..7d3c77a2f 100644 --- a/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js +++ b/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js @@ -1,4 +1,4 @@ -techlooper.directive("submissionChallenge", function (localStorageService, apiService, $timeout, $rootScope) { +techlooper.directive("submissionChallenge", function (localStorageService, apiService, $timeout, $rootScope, $translate) { return { restrict: "E", replace: true, @@ -8,6 +8,47 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe templateUrl: "modules/common/challenge/submissionChallenge.html", link: function (scope, el, attrs) { + var mixChallenge = function() { + scope.challenge.hideSubmitForm = function () { + scope.submissionForm.$setPristine(); + scope.submissionForm.$setUntouched(); + delete scope.challenge.visibleSubmitForm; + delete scope.submission.submissionURL; + delete scope.submission.submissionDescription; + } + + scope.challenge.showSubmitForm = function () { + localStorageService.set("submitNow", scope.challenge.challengeId); + apiService.joinNowByFB(); + } + + var challengeId = localStorageService.get("submitNow"); + if (challengeId == scope.challenge.challengeId) { + localStorageService.remove("submitNow"); + localStorageService.remove("joinNow"); + + var firstName = localStorageService.get("firstName"); + var lastName = localStorageService.get("lastName"); + var email = localStorageService.get("email"); + + apiService.joinContest(challengeId, firstName, lastName, email, $translate.use()) + .success(function() { + scope.challenge.visibleSubmitForm = true; + }); + } + } + + if (scope.challenge) { + mixChallenge(); + } + else { + scope.$watch("challenge", function() { + if (!scope.challenge) return; + mixChallenge(); + }); + } + + scope.submission = { name: localStorageService.get("firstName") + " " + localStorageService.get("lastName"), registrantEmail: localStorageService.get("email"), @@ -20,7 +61,7 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe if (scope.submissionForm.$invalid) { return false; } - $('.feedback-loading').css('visibility', 'inherit'); + //$('.feedback-loading').css('visibility', 'inherit'); apiService.getUrlResponseCode(scope.submission.submissionURL) .success(function (code) { var valid = (code >= 200) && (code < 400); @@ -35,27 +76,18 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe .finally(function () { $timeout(function () { $('.feedback-loading').css('visibility', 'hidden'); - scope.hideSubmitForm(); + scope.challenge.hideSubmitForm(); }, 500); }); } scope.submissionForm.submissionURL.$setValidity("invalidUrl", valid); }) - .finally(function () { - $timeout(function () { - $('.feedback-loading').css('visibility', 'hidden'); - scope.hideSubmitForm(); - }, 500); - });; - } - - scope.hideSubmitForm = function () { - scope.submissionForm.$setPristine(); - scope.submissionForm.$setUntouched(); - var subForm = $('.submit-phase-contest'); - subForm.removeClass('show'); - delete scope.submission.submissionURL; - delete scope.submission.submissionDescription; + //.finally(function () { + // $timeout(function () { + // $('.feedback-loading').css('visibility', 'hidden'); + // scope.challenge.hideSubmitForm(); + // }, 500); + //}); } } } diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index 6337561ae..6ffb3e0e7 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -78,7 +78,7 @@

ng-class="{disabled: !status('able-to-join')}"> -

diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index 709408877..43b2bcafb 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -197,6 +197,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.sortStartDate = $(["asc", "desc"]).not([$scope.sortStartDate]).get()[0]; utils.sortByNumber($scope.registrants, "registrantId", $scope.sortStartDate); } + $scope.updateScore = function (registrant, $event) { $($event.currentTarget).addClass('green'); apiService.saveChallengeRegistrant(registrant) @@ -209,15 +210,15 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l }); } - $scope.showSubmitForm = function () { - var subForm = $('.submit-phase-contest'); - if (subForm.hasClass('show')) { - subForm.removeClass('show'); - } - else { - subForm.addClass('show'); - } - }; + //$scope.showSubmitForm = function () { + // var subForm = $('.submit-phase-contest'); + // if (subForm.hasClass('show')) { + // subForm.removeClass('show'); + // } + // else { + // subForm.addClass('show'); + // } + //}; $scope.config = { registrantsFilter: resourcesService.registrantsFilterConfig }; diff --git a/src/main/webapp/assets/modules/contests/contest-list.html b/src/main/webapp/assets/modules/contests/contest-list.html index d3587988e..a457d4bcd 100644 --- a/src/main/webapp/assets/modules/contests/contest-list.html +++ b/src/main/webapp/assets/modules/contests/contest-list.html @@ -31,7 +31,7 @@ | - + | diff --git a/src/main/webapp/assets/modules/contests/contest.directive.js b/src/main/webapp/assets/modules/contests/contest.directive.js index 7c86f6131..6f9a0ab9a 100644 --- a/src/main/webapp/assets/modules/contests/contest.directive.js +++ b/src/main/webapp/assets/modules/contests/contest.directive.js @@ -4,16 +4,16 @@ techlooper.directive('contestList', function () { replace: true, templateUrl: "modules/contests/contest-list.html", link: function (scope, el, attrs) { - scope.showSubmitForm = function(id){ - $('.submit-phase-contest').removeClass('show'); - var parent = $('#id-'+id); - var div = parent.find('.submit-phase-contest'); - if(div.hasClass('show')){ - div.removeClass('show'); - }else{ - div.addClass('show'); - } - } + //scope.showSubmitForm = function(id){ + // $('.submit-phase-contest').removeClass('show'); + // var parent = $('#id-'+id); + // var div = parent.find('.submit-phase-contest'); + // if(div.hasClass('show')){ + // div.removeClass('show'); + // }else{ + // div.addClass('show'); + // } + //} } }; }); \ No newline at end of file From f9239ad2f68a7cb10b2addeb23483c157f2211bc Mon Sep 17 00:00:00 2001 From: Phuong H Date: Tue, 13 Oct 2015 18:51:34 +0700 Subject: [PATCH 6/6] Fix email sent before saving registrant --- .../java/com/techlooper/service/impl/ChallengeServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java b/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java index 3d225d6e1..019dc93aa 100644 --- a/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java +++ b/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java @@ -313,11 +313,11 @@ public ChallengeRegistrantEntity joinChallengeEntity(ChallengeRegistrantDto chal if (!isExist) { ChallengeRegistrantEntity challengeRegistrantEntity = dozerMapper.map(challengeRegistrantDto, ChallengeRegistrantEntity.class); ChallengeEntity challengeEntity = challengeRepository.findOne(challengeId); + challengeRegistrantEntity.setRegistrantId(new Date().getTime()); challengeRegistrantEntity = challengeRegistrantRepository.save(challengeRegistrantEntity); try { sendApplicationEmailToContestant(challengeEntity, challengeRegistrantEntity); sendApplicationEmailToEmployer(challengeEntity, challengeRegistrantEntity); - challengeRegistrantEntity.setRegistrantId(new Date().getTime()); challengeRegistrantEntity.setMailSent(Boolean.TRUE); return challengeRegistrantRepository.save(challengeRegistrantEntity); } catch (Exception e) {