Skip to content

Commit

Permalink
Merge pull request #480 from khoa-nd/master
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
khoa-nd committed Jan 5, 2016
2 parents 9765b5d + e2456ad commit 93e8282
Show file tree
Hide file tree
Showing 21 changed files with 171 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ private Map<String, Object> buildPostChallengeEmailTemplateModel(ChallengeEntity
templateModel.put("authorEmail", challengeEntity.getAuthorEmail());
templateModel.put("challengeOverview", challengeEntity.getChallengeOverview());
templateModel.put("challengeNameAlias", challengeEntity.getChallengeName().replaceAll("\\W", "-"));
templateModel.put("challengeType", challengeEntity.getChallengeType().getValue());
templateModel.put("companyDomains", StringUtils.join(challengeEntity.getCompanyDomains(), "<br/>"));
return templateModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ public Long joinChallenge(ChallengeRegistrantDto challengeRegistrantDto) {
}

challengeRegistrantEntity.setMailSent(Boolean.TRUE);
Integer passCode = DataUtils.getRandomNumberInRange(MIN_RANDOM_SEED_NUMBER, MAX_RANDOM_SEED_NUMBER);
challengeRegistrantEntity.setPassCode(passCode);
if (challengeEntity.getChallengeType() == ChallengeTypeEnum.INTERNAL) {
Integer passCode = DataUtils.getRandomNumberInRange(MIN_RANDOM_SEED_NUMBER, MAX_RANDOM_SEED_NUMBER);
challengeRegistrantEntity.setPassCode(passCode);
}
challengeRegistrantEntity = challengeRegistrantRepository.save(challengeRegistrantEntity);
challengeEmailService.sendApplicationEmailToContestant(challengeEntity, challengeRegistrantEntity);

Expand Down Expand Up @@ -287,7 +289,10 @@ private NativeSearchQueryBuilder getChallengeSearchQueryBuilder(ChallengeFilterC
String challengeSearchText = challengeFilterCondition.getChallengeSearchText();
if (StringUtils.isNotEmpty(challengeSearchText)) {
boolQueryBuilder.should(matchQuery("challengeName", challengeSearchText));
boolQueryBuilder.should(matchQuery("companyDomains", challengeSearchText));

StringBuilder domainNameQueryStringBuilder = new StringBuilder();
domainNameQueryStringBuilder.append("*").append(challengeSearchText).append("*");
boolQueryBuilder.should(wildcardQuery("companyDomains", domainNameQueryStringBuilder.toString()));
} else {
boolQueryBuilder.should(matchAllQuery());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,16 @@
<img height="10px" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<tr>
<td width="30%" align="left" style="padding-right: 5px">
Password:
</td>
<td width="70%" align="left">
<strong>${passCode}</strong>
</td>
</tr>
<#if passCode??>
<tr>
<td width="30%" align="left" style="padding-right: 5px">
Password:
</td>
<td width="70%" align="left">
<strong>${passCode}</strong>
</td>
</tr>
</#if>
</table>
</td>
<td width="30px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,16 @@
<img height="10px" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<tr>
<td width="30%" align="left" style="padding-right: 5px">
Mật Khẩu:
</td>
<td width="70%" align="left">
<strong>${passCode}</strong>
</td>
</tr>
<#if passCode??>
<tr>
<td width="30%" align="left" style="padding-right: 5px">
Mật Khẩu:
</td>
<td width="70%" align="left">
<strong>${passCode}</strong>
</td>
</tr>
</#if>
</table>
</td>
<td width="30px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@
</tr>
<tr>
<td align="left" style="font-size: 14px;">
This person <strong>${authorEmail}</strong> has just created successfully a challenge as follows
<#if challengeType == "PUBLIC">
<#assign localizedChallengeType = "a public">
<#elseif challengeType == "INTERNAL">
<#assign localizedChallengeType = "an internal">
</#if>
This person <strong>${authorEmail}</strong> has just created successfully <#if localizedChallengeType??>${localizedChallengeType}</#if> challenge as follows
</td>
</tr>
<tr>
Expand Down Expand Up @@ -201,6 +206,24 @@
<img height="1" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<#if companyDomains??>
<tr>
<td align="left" width="45%" style="font-size: 14px; padding-left: 15px" valign="top">
Internal domain(s):
</td>
<td align="left" width="55%" style="color: #000000; font-size: 14px;">
${companyDomains}
</td>
</tr>
<tr>
<td style="height:5px; line-height: 5px;">
<img height="1" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
<td style="height:5px; line-height: 5px;">
<img height="1" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
</#if>
<tr>
<td align="left" width="45%" style="font-size: 14px; padding-left: 15px" valign="top">
Challenge Overview:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,13 @@
</td>
</tr>
<tr>
<#if challengeType == "PUBLIC">
<#assign localizedChallengeType = "công cộng">
<#elseif challengeType == "INTERNAL">
<#assign localizedChallengeType = "nội bộ">
</#if>
<td align="left" style="font-size: 14px;">
<strong>${authorEmail}</strong> vừa đăng thử thách với thông tin như sau:
<strong>${authorEmail}</strong> vừa đăng thử thách <#if localizedChallengeType??>${localizedChallengeType}</#if> với thông tin như sau:
</td>
</tr>
<tr>
Expand Down Expand Up @@ -201,6 +206,24 @@
<img height="1" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
<#if companyDomains??>
<tr>
<td align="left" width="45%" style="font-size: 14px; padding-left: 15px" valign="top">
Tên Miền Nội Bộ:
</td>
<td align="left" width="55%" style="color: #000000; font-size: 14px;">
${companyDomains}
</td>
</tr>
<tr>
<td style="height:5px; line-height: 5px;">
<img height="1" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
<td style="height:5px; line-height: 5px;">
<img height="1" width="1" src="http://images.vietnamworks.com/x.gif" style="display:block; border: 0px" />
</td>
</tr>
</#if>
<tr>
<td align="left" width="45%" style="font-size: 14px; padding-left: 15px" valign="top">
Tổng Quan Thử Thách:
Expand Down
9 changes: 4 additions & 5 deletions src/main/webapp/assets/modules/common/feedback/feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
<div class="mail-text h-200">
<summernote name="content" ng-model="composeEmail.content" config="$root.jsonValue.summerNoteConfig"
ng-required="true"></summernote>
<!--<div class="summernote"></div>-->
<!--<div class="send-mail-error" ng-show="!composeEmail.error" data-ng-init="composeEmail.error = true">-->
<!--<p translate="cannotSendMail"></p>-->
<!--</div>-->
</div>
<div class="mail-body text-right tooltip-demo email-footer">
<a class="btn btn-sm btn-primary" title="{{'mailSend' | translate}}" ng-click="send()"><i
Expand All @@ -47,7 +43,10 @@
class="fa fa-times"></i>
<span translate="cancel"></span></a>
</div>
<div class="feedback-loading"></div>
<div class="loading-data-server" ng-show="loadingData"></div>
<div class="alert-post-successes" ng-show="postFeedbackSuccess">
<p translate="emailSentSuccessfully"></p>
</div>
</div>
</ng-form>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ techlooper.directive("feedbackForm", function (apiService, $timeout, resourcesSe

scope.send = function () {
if (scope.feedbackForm.$invalid) return;
scope.loadingData = true;
var registrant = scope.registrants[0];
apiService.sendFeedbackToRegistrant(registrant.registrantId, scope.composeEmail)
.success(function () {
scope.cancel();
});
scope.postFeedbackSuccess = true;
}).finally(function(){
delete scope.loadingData;
$timeout(function(){
delete scope.postFeedbackSuccess;
scope.cancel();
}, 2000);
}
);
}

scope.cancel = function () {
Expand Down
9 changes: 6 additions & 3 deletions src/main/webapp/assets/modules/common/json.val.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,21 @@ techlooper.factory("jsonValue", function () {
name: "login",
url: "/login",
cancelIfAlreadyLogin: true,
type: "LOGIN"
type: "LOGIN",
isLoginPage: true
},
{
name: "userType",
url: "/user-type",
cancelIfAlreadyLogin: true,
type: "LOGIN"
type: "LOGIN",
isLoginPage: true
},
{
name: "loading",
url: "/loading",
type: "LOGIN"
type: "LOGIN",
isLoginPage: true
},
{
name: "eventDetails",
Expand Down
Loading

0 comments on commit 93e8282

Please sign in to comment.