Skip to content

Commit

Permalink
Merge pull request #477 from khoa-nd/master
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
khoa-nd committed Dec 30, 2015
2 parents f3cf5ee + 027bcae commit e276da2
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
</tr>
<tr>
<td>
<img src="${webBaseUrl}images/join-internal-challenge.png" alt="" style="width:100%">
<img src="${webBaseUrl}images/join-internal-challenge-vi.png" alt="" style="width:100%">
</td>
</tr>
<tr>
Expand All @@ -336,7 +336,7 @@
</tr>
<tr>
<td>
<img src="${webBaseUrl}images/submission-form.png" alt="" style="width:100%">
<img src="${webBaseUrl}images/submission-form-vi.png" alt="" style="width:100%">
</td>
</tr>
</table>
Expand Down
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.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ techlooper
restrict: 'A',
link: function (scope, element, attrs, ngModelCtrl) {
scope.$watch(attrs.ngModel, function (newValue, oldValue) {
var array = $parse(attrs.ngModel)(scope);
var array = $parse(attrs.ngModel)(scope) || [];
ngModelCtrl.$setValidity("required", array.length > 0);
}, true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<div class="row join-internal-challenge">
<ng-form name="joinInternalForm" autocomplete="off" role="form" class="form-horizontal">
<p ng-if="challenge.$isInternal && challenge.companyDomains.length" class="text-center">
{{'joinInternalChallengeWith' | translate}}
<span ng-repeat="domain in challenge.companyDomains">
<strong>{{domain}}</strong>&nbsp;<span ng-if="!$last" translate="or"></span>&nbsp;
</span>
</p>
<div class="form-group">
<div class="col-sm-6">
<label for="ic-firstName"><span translate="firstName"></span>: <strong>*</strong></label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<div class="submit-phase-contest show" ng-show="visibleSubmitForm">
<ng-form name="submissionForm" autocomplete="off">
<p ng-if="challenge.$isInternal && challenge.companyDomains.length" class="text-center">
{{'joinInternalChallengeWith' | translate}}
<span ng-repeat="domain in challenge.companyDomains">
<strong>{{domain}}</strong>&nbsp;<span ng-if="!$last" translate="or"></span>&nbsp;
</span>
</p>

<div class="error-messages"
ng-show="submissionForm.submissionPassCode.$error.credential && (submissionForm.submissionPassCode.$dirty || submissionForm.$submitted)"
translate="invalidCredential" />
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")
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 = {};
}
}
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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ techlooper.filter("challengeDetail", function (apiService, $rootScope, jsonValue
if (!criteria) return [];
challengeDetail.totalWeight = 0;
return criteria.map(function (cri) {
var weight = _.isNumber(cri.weight) ? cri.weight : 0;
var weight = $.isNumeric(cri.weight) ? parseInt(cri.weight) : 0;
challengeDetail.totalWeight += weight;
return cri;
});
Expand Down Expand Up @@ -356,7 +356,7 @@ techlooper.filter("challengeDetail", function (apiService, $rootScope, jsonValue
_.each(finalRegistrants, function (registrant) {
if (registrant.disqualified == true) return;
var count = _.countBy(registrant.criteria, function (cri) {
return _.isNumber(cri.score) ? "hasScore" : "notHasScore";
return $.isNumeric(cri.score) ? "hasScore" : "notHasScore";
});
countWinnerPaticipants += (count.hasScore > 0) ? 1 : 0;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ techlooper.filter("challengeRegistrant", function (apiService, $rootScope, jsonV
}
//delete registrant.$savedCriteria;

_.each(registrant.criteria, function (cri) {(!_.isNumber(cri.score)) && (cri.score = 0);});
_.each(registrant.criteria, function (cri) {(!$.isNumeric(cri.score)) && (cri.score = 0);});

apiService.saveChallengeRegistrantCriteria(criteria)
.success(function (data) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/assets/modules/home-page/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h4 translate="sendMeJobs"></h4>
<h3 translate="whatCurrentTrend"></h3>
<div class="box-content">
<div class="box-header">
<h4>{{homePage.termStatistic.term}}</h4>
<h4>{{homePage.termStatistic.label}}</h4>
<a href="#/analytics/skill/{{homePage.termStatistic.term}}" translate="viewDetails"></a>
</div>
<div class="box-content-detail">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ <h3 class="none-capitalize" translate="challengeTypeSelection"></h3>
<div ng-if="contest.challengeType == 'INTERNAL'">
<tagbox name="companyDomains" tags="contest.companyDomains"
type="text" placeholder="{{'companyDomainEx' | translate}}" list-max-length="3"
ng-model="contest.companyDomain" array-model touchable enable-validators="domainName"></tagbox>
ng-model="contest.companyDomains" array-model touchable enable-validators="domainName"></tagbox>

<div class="error-messages"
ng-show="challengeForm.companyDomain.$error.required && (challengeForm.companyDomain.$edited || challengeForm.$submitted)"
ng-show="rewardForm.companyDomains.$error.required && (rewardForm.companyDomains.$edited || rewardForm.$submitted)"
translate="listRequire1Item"></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/assets/modules/translation/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -881,15 +881,15 @@
"SearchChallengePlaceholder": "Enter challenge name or company domain to search challenge",
"allChallengesSearch": "All Challenges",
"invalidDomainName": "Invalid domain name format",
"emailDomainNotMatch": "Email domain invalid",
"emailDomainNotMatch": "Email domain is invalid",
"joinInternalChallengeWith": "Join with your email from:",
"enterYourPassword": "Enter your password",
"enterYourEmail": "Enter your email",
"signInInternalChallengeTitle": "First, Let Us Know Who You Are",
"emailChallengeFormat": "Sign in using your registered email address and password for this challenge.",
"passCode": "Pass Code: <strong>*</strong>",
"enterYourPassCode": "Enter your pass code",
"domainLabel": "Domain:",
"domainLabel": "Domains:",
"invalidCredential": "Invalid credential",
"invalidMinlengthDigits": "This field can not less than {{length}} digits"
}
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@
"SearchChallengePlaceholder": "Điền tên thử thách hay tên miền để tìm kiếm",
"allChallengesSearch": "Mọi Thử Thách",
"invalidDomainName": "Tên miền không đúng định dạng",
"emailDomainNotMatch": "Tên miền mail không hợp lệ",
"emailDomainNotMatch": "Tên miền email không hợp lệ",
"joinInternalChallengeWith": "Tham gia bằng email với tên miền:",
"enterYourPassword": "Nhập mật khẩu",
"enterYourEmail": "Nhập email",
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/assets/sass/contest-detail.sass
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,9 @@
color: red
font-size: 12px
font-style: italic
p
span
text-transform: lowercase
.col-md-12
padding: 0
.contest-content-item
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/assets/sass/contests.sass
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@
color: red
font-size: 12px
font-style: italic
p
span
text-transform: lowercase
.contest-item-row.internal
background-color: #fffef5
.challenge-name-col
Expand Down
6 changes: 5 additions & 1 deletion src/main/webapp/assets/sass/home.sass
Original file line number Diff line number Diff line change
Expand Up @@ -1062,4 +1062,8 @@
padding: 20px 20px 10px 20px
.tooltip-inner
color: #919191 !important
text-align: left !important
text-align: left !important
padding: 15px
font-size: 12px
line-height: 14px
font-weight: 300

0 comments on commit e276da2

Please sign in to comment.