Skip to content

Commit

Permalink
Merge pull request #457 from khoa-nd/master
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
khoa-nd committed Nov 19, 2015
2 parents b5ac929 + 951c01c commit 86048d6
Show file tree
Hide file tree
Showing 22 changed files with 147 additions and 213 deletions.
20 changes: 16 additions & 4 deletions src/main/java/com/techlooper/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public PersonalHomepageDto getPersonalHomepageDto() {
@RequestMapping(value = "/user/current", method = RequestMethod.GET)
public UserProfileDto getUserProfile(HttpServletRequest request) {
LOGGER.debug("Reading current user profile info");
org.springframework.security.core.Authentication authentication = (org.springframework.security.core.Authentication)request.getUserPrincipal();
org.springframework.security.core.Authentication authentication = (org.springframework.security.core.Authentication) request.getUserPrincipal();
Object principal = authentication.getPrincipal();
if (!(principal instanceof UserProfileDto)) {
return dozerMapper.map(userService.findVnwUserByUsername(request.getRemoteUser()), UserProfileDto.class);
Expand All @@ -343,7 +343,7 @@ public DashBoardInfo getEmployerDashboardInfo(HttpServletRequest request) {
@PreAuthorize("hasAnyAuthority('EMPLOYER', 'JOB_SEEKER')")
@RequestMapping(value = "/user/employer/webinar", method = RequestMethod.POST)
public WebinarInfoDto createWebinar(@RequestBody WebinarInfoDto webinarInfoDto, HttpServletRequest request) throws IOException {
org.springframework.security.core.Authentication authentication = (org.springframework.security.core.Authentication)request.getUserPrincipal();
org.springframework.security.core.Authentication authentication = (org.springframework.security.core.Authentication) request.getUserPrincipal();
Object principal = authentication.getPrincipal();
UserProfileDto organiser = (principal instanceof UserProfileDto) ? ((UserProfileDto) principal) :
dozerMapper.map(getVnwCurrentUser(request), UserProfileDto.class);
Expand Down Expand Up @@ -392,8 +392,20 @@ public void sendEmailToDailyChallengeRegistrants(HttpServletRequest request, Htt
@RequestMapping(value = "user/challenge/feedback/{registrantId}", method = RequestMethod.POST)
public void sendFeedbackToRegistrant(HttpServletRequest request, HttpServletResponse response,
@PathVariable Long registrantId, @RequestBody EmailContent emailContent) {
if (!emailService.sendEmailToRegistrant(request.getRemoteUser(), registrantId, emailContent)) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
ChallengeRegistrantEntity registrant = challengeRegistrantService.findRegistrantById(registrantId);
if (registrant != null) {
String ownerEmail = request.getRemoteUser();
Long challengeId = registrant.getChallengeId();
if (challengeService.isChallengeOwner(ownerEmail, challengeId)) {
boolean success = emailService.sendEmailToRegistrant(request.getRemoteUser(), registrantId, emailContent);
if (!success) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
} else {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
}
} else {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
}
}

Expand Down
62 changes: 41 additions & 21 deletions src/main/resources/template/notifyChallengePhaseClosed.en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -174,27 +174,27 @@
<tr>
<td align="left" style="font-size: 14px;">
<#if oldPhase == "REGISTRATION">
<#assign localizedOldPhase = "Registration">
<#assign localizedOldPhase = "Registration">
<#elseif oldPhase == "IDEA">
<#assign localizedOldPhase = "Idea">
<#assign localizedOldPhase = "Idea">
<#elseif oldPhase == "UIUX">
<#assign localizedOldPhase = "UI/UX">
<#assign localizedOldPhase = "UI/UX">
<#elseif oldPhase == "PROTOTYPE">
<#assign localizedOldPhase = "Prototype">
<#assign localizedOldPhase = "Prototype">
<#elseif oldPhase == "FINAL">
<#assign localizedOldPhase = "Final App">
<#assign localizedOldPhase = "Final App">
</#if>

<#if currentPhase == "REGISTRATION">
<#assign localizedCurrentPhase = "Registration">
<#assign localizedCurrentPhase = "Registration">
<#elseif currentPhase == "IDEA">
<#assign localizedCurrentPhase = "Idea">
<#assign localizedCurrentPhase = "Idea">
<#elseif currentPhase == "UIUX">
<#assign localizedCurrentPhase = "UI/UX">
<#assign localizedCurrentPhase = "UI/UX">
<#elseif currentPhase == "PROTOTYPE">
<#assign localizedCurrentPhase = "Prototype">
<#assign localizedCurrentPhase = "Prototype">
<#elseif currentPhase == "FINAL">
<#assign localizedCurrentPhase = "Final App">
<#assign localizedCurrentPhase = "Final App">
</#if>
The phase <strong>${localizedOldPhase}</strong> of challenge <a href="${webBaseUrl}#/challenge-detail/${challengeNameAlias}-${challengeId}-id?utm_source=remindphaseclose&utm_medium=clickchallenge&utm_campaign=onlinecontest" style="color:#337ab7" target="_blank"><strong>${challenge.challengeName}</strong></a> just ended. The current phase is now <strong>${localizedCurrentPhase}</strong> with <strong>${currentPhaseRegistrants}</strong> selected.
</td>
Expand Down Expand Up @@ -240,7 +240,7 @@
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 10px 10px 0; float: left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 10px 10px 0; float: left">
<tr>
<td width="100%" align="left">
1. To select 1 contestant:
Expand All @@ -263,10 +263,20 @@
</td>
</tr>
</table>
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 0; float: left">

</td>
</tr>
<tr>
<td style="height:10px; line-height: 10px;" width="100%">
<img height="10px" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 0; float: left">
<tr>
<td width="100%">
<img alt="Challenge Online" class="logo" src="http://staging.techlooper.com/images/why-challenge-banner.jpg" style="border:none; outline:none" width="100%"/>
<img alt="Challenge Online" class="logo" src="${webBaseUrl}images/tip-for-qualify.png" style="border:none; outline:none" width="100%"/>
</td>
</tr>
</table>
Expand All @@ -279,14 +289,7 @@
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 0; float: left">
<tr>
<td width="100%">
<img alt="Challenge Online" class="logo" src="http://staging.techlooper.com/images/why-challenge-banner.jpg" style="border:none; outline:none" width="100%"/>
</td>
</tr>
</table>
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 0 10px 10px; float: left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 0 10px 10px; float: left">
<tr>
<td width="100%" align="left">
2. To select multiple contestants:
Expand All @@ -311,6 +314,23 @@
</table>
</td>
</tr>
<tr>
<td style="height:10px; line-height: 10px;" width="100%">
<img height="10px" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 0; float: left">
<tr>
<td width="100%">
<img alt="Challenge Online" class="logo" src="${webBaseUrl}images/tip-for-qualify-all.png" style="border:none; outline:none" width="100%"/>
</td>
</tr>
</table>
</td>
</tr>

</table>
</td>
</tr>
Expand Down
41 changes: 30 additions & 11 deletions src/main/resources/template/notifyChallengePhaseClosed.vi.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 10px 10px 0; float: left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 10px 10px 0; float: left">
<tr>
<td width="100%" align="left">
1. Để chọn 1 thí sinh bất kỳ:
Expand All @@ -240,10 +240,19 @@
</td>
</tr>
</table>
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 0; float: left">
</td>
</tr>
<tr>
<td style="height:10px; line-height: 10px;" width="100%">
<img height="10px" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 0; float: left">
<tr>
<td width="100%">
<img alt="Challenge Online" class="logo" src="${webBaseUrl}images/why-challenge-banner.jpg" style="border:none; outline:none" width="100%"/>
<img alt="Challenge Online" class="logo" src="${webBaseUrl}images/tip-for-qualify.png" style="border:none; outline:none" width="100%"/>
</td>
</tr>
</table>
Expand All @@ -256,14 +265,7 @@
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 0; float: left">
<tr>
<td width="100%">
<img alt="Challenge Online" class="logo" src="${webBaseUrl}images/why-challenge-banner.jpg" style="border:none; outline:none" width="100%"/>
</td>
</tr>
</table>
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="50%" style="margin:0 auto; padding:10px 0 10px 10px; float: left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 0 10px 10px; float: left">
<tr>
<td width="100%" align="left">
2. Để chọn nhiều thí sinh cùng lúc:
Expand All @@ -288,6 +290,23 @@
</table>
</td>
</tr>

<tr>
<td style="height:10px; line-height: 10px;" width="100%">
<img height="10px" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<tr>
<td width="100%" align="left">
<table align="center" cellspacing="0" cellpadding="2" class="deviceWidth" width="100%" style="margin:0 auto; padding:10px 0; float: left">
<tr>
<td width="100%">
<img alt="Challenge Online" class="logo" src="${webBaseUrl}images/tip-for-qualify-all.png" style="border:none; outline:none" width="100%"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
Expand Down
Binary file modified src/main/webapp/assets/images/like.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/webapp/assets/images/qualify-all-to-next-phase-en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/webapp/assets/images/qualify-all-to-next-phase-vi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/assets/images/tip-for-qualify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/main/webapp/assets/index.tem.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@

<link rel="stylesheet" href="bower_components/summernote/dist/summernote.css"/>
<link rel="stylesheet" href="bower_components/summernote/dist/summernote-bs3.css"/>
<link rel="stylesheet" href="custom-css/swrap-bootstrap/style.css"/>

<!-- include: "type": "css", "files": "css/**/*.css" -->
<!-- endbuild -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/assets/modules/_appStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ techlooper.run(function (connectionFactory, loadingBoxFactory, cleanupFactory, u
break;

case "redirectJA":
window.location.href = param.targetUrl;
window.location.href = (param.targetUrl.startsWith("http://") || param.targetUrl.startsWith("https://")) ? param.targetUrl : "http://" + param.targetUrl;
break;

case "cancel":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,84 +25,32 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe
apiService.joinNowByFB();
}

var challengeId = localStorageService.get("submitNow");
if (scope.challenge && (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");
scope.$watch("challenge", function() {
var challengeId = localStorageService.get("submitNow");
if (scope.challenge && (challengeId == scope.challenge.challengeId)) {
localStorageService.remove("submitNow");
localStorageService.remove("joinNow");

apiService.findRegistrantActivePhase(challengeId, email)
.success(function (phase) {
scope.submission.submissionPhase = phase;
})

//apiService.joinContest(challengeId, firstName, lastName, email, $translate.use())
// .success(function() {
scope.visibleSubmitForm = true;
//});
//scope.challenge.mixed = true;
}

//var activePhase;
var firstName = localStorageService.get("firstName");
var lastName = localStorageService.get("lastName");
var email = localStorageService.get("email");

//var mixChallenge = function () {
// scope.challenge.hideSubmitForm = function () {
// if (scope.submissionForm) {
// 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.findRegistrantActivePhase(challengeId, email)
// .success(function (phase) {
// scope.submission.submissionPhase = phase;
// })
//
// //apiService.joinContest(challengeId, firstName, lastName, email, $translate.use())
// // .success(function() {
// scope.challenge.visibleSubmitForm = true;
// //});
// //scope.challenge.mixed = true;
// }
//}
//
//if (scope.challenge) {
// mixChallenge();
//}
//else {
// scope.$watch("challenge", function () {
// if (!scope.challenge) return;
// mixChallenge();
// });
//}
apiService.findRegistrantActivePhase(challengeId, email)
.success(function (phase) {
scope.submission.submissionPhase = phase;
})

scope.visibleSubmitForm = true;
}

scope.submission = {
name: localStorageService.get("firstName") + " " + localStorageService.get("lastName"),
registrantEmail: localStorageService.get("email"),
registrantFirstName: localStorageService.get("firstName"),
registrantLastName: localStorageService.get("lastName")
}
scope.submission = {
name: localStorageService.get("firstName") + " " + localStorageService.get("lastName"),
registrantEmail: localStorageService.get("email"),
registrantFirstName: localStorageService.get("firstName"),
registrantLastName: localStorageService.get("lastName")
}
});

scope.pushChallengePhase = function () {
scope.submissionForm.$setSubmitted();
Expand Down
Loading

0 comments on commit 86048d6

Please sign in to comment.