Skip to content

Commit

Permalink
Merge pull request #432 from phuonghuynh/master
Browse files Browse the repository at this point in the history
Update changes
  • Loading branch information
phuonghuynh committed Oct 13, 2015
2 parents e94bac8 + f9239ad commit 677a5b9
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="submit-phase-contest">
<div class="submit-phase-contest show" ng-show="challenge.visibleSubmitForm">
<ng-form name="submissionForm" autocomplete="off">
<div class="registrant-name">
<span translate="fullName"></span>
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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"),
Expand All @@ -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);
Expand All @@ -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);
//});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</form>
</div>
<div class="mail-text h-200">
<div class="summernote"></div>
<summernote ng-model="feedbackContent" focus config="options"></summernote>
<div class="send-mail-error" ng-show="!composeEmail.error" data-ng-init="composeEmail.error = true">
<p translate="cannotSendMail"></p>
</div>
Expand Down
24 changes: 15 additions & 9 deletions src/main/webapp/assets/modules/common/email/popupEmailDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']]
]
});
};
}
}
});
1 change: 0 additions & 1 deletion src/main/webapp/assets/modules/common/securityService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h3 translate="currentPhase"/>
ng-class="{disabled: !status('able-to-join')}">
<i class="fa fa-facebook-square"></i> <span translate="joinNow"></span></button>

<button ng-show="contestDetail.currentUserJoined == true" ng-click="showSubmitForm()"
<button ng-show="contestDetail.currentUserJoined == true" ng-click="contestDetail.showSubmitForm()"
class="btn btn-primary btn-flat">
<i class="fa fa-paper-plane-o"></i> <span translate="submitPhase"></span></button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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)
Expand All @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
<div class="body-row">
<div class="submitted-row" ng-repeat="submission in registrant.submissions | orderBy: '-challengeSubmissionId'">
<div class="subject-col">
<label translate="descriptionCol"></label>
{{submission.submissionDescription}}
</div>
<div class="submission-link-col">
<label translate="submissionLink"></label>
<a target="_blank" ng-click="goToSubmissionLink(submission.submissionURL)">
{{submission.submissionURL}}
</a>
</div>
<div class="date-col">
<label translate="date"></label>
{{submission.submissionDateTime}}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/assets/modules/contests/contest-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<a href="#/challenge-detail/{{contest.challengeName | nonAscii}}-{{contest.challengeId}}-id" title="{{'viewDetails' | translate}}" target="_blank">
<i class="fa fa-eye"></i> | <span translate="detail"></span>
</a>
<a title="{{'submitPhase' | translate}}" ng-click="showSubmitForm(contest.challengeId)" ng-show="contest.currentUserJoined == true">
<a title="{{'submitPhase' | translate}}" ng-click="contest.showSubmitForm()" ng-show="contest.currentUserJoined == true">
<i class="fa fa-paper-plane-o"></i> | <span translate="submitPhase"></span>
</a>
<a title="{{'join' | translate}}" ng-show="contest.currentUserJoined == false" ng-click="joinNowByFB(contest)">
Expand Down
20 changes: 10 additions & 10 deletions src/main/webapp/assets/modules/contests/contest.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
// }
//}
}
};
});
5 changes: 5 additions & 0 deletions src/main/webapp/assets/sass/contest-detail.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/assets/sass/dashboard.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions src/main/webapp/assets/sass/z-responsive-candidate.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 677a5b9

Please sign in to comment.