Skip to content

Commit

Permalink
Merge pull request #483 from phuonghuynh/master
Browse files Browse the repository at this point in the history
Update changes
  • Loading branch information
phuonghuynh committed Jan 7, 2016
2 parents 5f2607f + be4fb85 commit b82ff19
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<#elseif challengeType == "INTERNAL">
<#assign localizedChallengeType = "an internal">
</#if>
This person <strong>${authorEmail}</strong> has just created successfully <#if localizedChallengeType??><strong>${localizedChallengeType}</strong></#if> challenge as follows
This person <strong>${authorEmail}</strong> has just created successfully <#if localizedChallengeType??><strong>${localizedChallengeType} challenge</strong></#if> as follows
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<#assign localizedChallengeType = "nội bộ">
</#if>
<td align="left" style="font-size: 14px;">
<strong>${authorEmail}</strong> vừa đăng thử thách <#if localizedChallengeType??><strong>${localizedChallengeType}</strong></#if> với thông tin như sau:
<strong>${authorEmail}</strong> vừa đăng <#if localizedChallengeType??><strong>thử thách ${localizedChallengeType}</strong></#if> với thông tin như sau:
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,32 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe
});

scope.visibleSubmitForm = true;
}

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

if (scope.challenge.$isInternal && scope.submissionForm && scope.submissionForm.internalEmail) {
scope.submissionForm.internalEmail.$validators.domainMatch = function (modelValue, viewValue) {
if (!modelValue) return true;
if (modelValue.length == 0) return true;
if (scope.submissionForm.internalEmail.$error.email) return true;
if (scope.challenge.$isInternal && scope.submissionForm && scope.submissionForm.internalEmail) {
scope.submissionForm.internalEmail.$validators.domainMatch = function (modelValue, viewValue) {
if (!modelValue) return true;
if (modelValue.length == 0) return true;
if (scope.submissionForm.internalEmail.$error.email) return true;

var valid = false;
$.each(scope.challenge.companyDomains, function (i, companyDomain) {
return !(valid = new RegExp("( |^)[^ ]*@[a-zA-Z0-9.]*" + companyDomain + "( |$)").test(modelValue));
});
return valid;
};
}
var valid = false;
$.each(scope.challenge.companyDomains, function (i, companyDomain) {
return !(valid = new RegExp("( |^)[^ ]*@[a-zA-Z0-9.]*" + companyDomain + "( |$)").test(modelValue));
});
return valid;
};
}
}
scope.$watch("challenge", function () {
Expand All @@ -91,22 +91,19 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe
var inValid = (code == 404);
if (!inValid) {
scope.submission.challengeId = scope.challenge.challengeId;
$('.feedback-loading').css('visibility', 'inherit');

apiService.submitMyResult(scope.submission)
.success(function (data) {
var submission = data;
$rootScope.$broadcast("submission-accepted", submission);
scope.form.hideSubmitForm();
delete scope.loadingData;
})
.error(function () {
scope.submissionForm.submissionPassCode.$setValidity("credential", false);
});
}
scope.submissionForm && scope.submissionForm.submissionURL.$setValidity("invalidUrl", !inValid);
})
.finally(function() {
delete scope.loadingData;
scope.form.hideSubmitForm();
delete scope.loadingData;
});
}
}
Expand Down

0 comments on commit b82ff19

Please sign in to comment.