Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit d736c79

Browse files
author
Parth Shah
committed
Merge branch 'dev' into tony-srm-winner-update
2 parents 1de6a30 + 1708a07 commit d736c79

File tree

53 files changed

+461
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+461
-275
lines changed

app/account/register/register.controller.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
var isValidCountry = _.isUndefined(countryCode) ? false : true;
3838
vm.registerForm.country.$setValidity('required', isValidCountry);
39+
vm.isValidCountry = isValidCountry;
3940
if (isValidCountry) {
4041
vm.country = angucompleteCountryObj.originalObject;
4142
}
@@ -103,8 +104,20 @@
103104
var socialData = resp.data;
104105
vm.socialUserId = socialData.socialUserId;
105106
vm.username = socialData.username;
107+
if (socialData.username) {
108+
vm.registerForm.username.$setDirty();
109+
}
106110
vm.firstname = socialData.firstname;
111+
if (socialData.firstname) {
112+
vm.registerForm.firstname.$setDirty();
113+
}
107114
vm.lastname = socialData.lastname;
115+
if (socialData.lastname) {
116+
vm.registerForm.lastname.$setDirty();
117+
}
118+
if (socialData.email) {
119+
vm.registerForm.email.$setDirty();
120+
}
108121
vm.email = socialData.email;
109122
vm.socialProfile = socialData.socialProfile;
110123
vm.socialProvider = socialData.socialProvider;

app/account/register/register.jade

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
minlength="1"
3636
)
3737

38-
.form-input-error(ng-show="vm.registerForm.country.$dirty && vm.registerForm.country.$invalid", ng-messages="vm.registerForm.country.$error")
39-
p.form-error(ng-message="required") Please choose a country from the list
38+
.form-input-error(ng-show="vm.registerForm.country.$dirty && !vm.isValidCountry")
39+
p.form-error(ng-show="!vm.isValidCountry") Please choose a country from the list
4040

4141
.section-break
4242
hr
@@ -97,7 +97,8 @@
9797
section.terms
9898
p By clicking "Join" you agree to Topcoder's #[a(href="http://www.topcoder.com/community/how-it-works/terms/", target="_blank") Terms] and #[a(href="http://www.topcoder.com/community/how-it-works/privacy-policy/", target="_blank") Privacy Policy]
9999

100-
button.tc-btn.tc-btn-large(type="submit", tc-busy-button, tc-busy-when="vm.registering", ng-disabled="vm.registerForm.$invalid") Join
100+
button.tc-btn.tc-btn-large(type="submit", tc-busy-button, tc-busy-when="vm.registering", ng-disabled="vm.registerForm.$invalid", ng-show="vm.isValidCountry") Join
101+
button.tc-btn.tc-btn-large.disabled(type="submit", ng-show="!vm.isValidCountry", disabled="disabled") Join
101102

102103
section.login-options
103104
p.tc-separator

app/community/community.controller.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/community/community.routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
'community': {
1515
parent: 'root',
1616
url: '/community/',
17+
abstract: true,
1718
data: {
1819
authRequired: false,
19-
},
20-
controller: 'BaseCommunityController'
20+
}
2121
},
2222
'community.members': {
2323
parent: 'root',

app/directives/account/toggle-password-with-tips/toggle-password-with-tips.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ input#password-input(
1212

1313
ng-minlength="8",
1414
ng-maxlength="64",
15+
maxlength="64",
1516
has-letter,
1617
has-symbol-or-number,
1718
required)

app/directives/busy-button/busy-button.directive.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
angular.module('tcUIComponents').directive('tcBusyButton', tcBusyButton);
55

6-
function tcBusyButton() {
6+
tcBusyButton.$inject = ['$parse'];
7+
8+
function tcBusyButton($parse) {
79
return {
810
restrict: "A",
911
scope: {
@@ -21,7 +23,11 @@
2123
scope);
2224
element.attr('disabled', true).html('').append(busyMessageHtml);
2325
} else {
24-
element.removeAttr('disabled').html(scope.originalContent);
26+
// remove the disabled attribute only if either element does not have ng-disabled set
27+
// or it evaluates to false
28+
if (!attr.ngDisabled || !$parse(attr.ngDisabled)) {
29+
element.removeAttr('disabled').html(scope.originalContent);
30+
}
2531
}
2632
});
2733
}

app/directives/challenge-links/challenge-links.directive.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
p(ng-switch-when="MARATHON_MATCH") {{challenge.numRegistrants[0]}}
66
p(ng-switch-default) {{challenge.numRegistrants}}
77

8-
a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="")
8+
a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="{{challenge|challengeLinks:'registrants'}}")
99
.icon.submissions-icon
1010
p {{challenge.numSubmissions}}
1111

app/directives/challenge-tile/challenge-tile.directive.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
ChallengeService.processPastMarathonMatch($scope.challenge);
2525
}
2626

27-
if ($scope.challenge.status.trim().toUpperCase() === 'COMPLETED' && $scope.challenge.track === 'DESIGN') {
28-
ChallengeService.formatPastDesignChallenge($scope.challenge);
29-
console.log($scope.challenge.plain());
30-
}
3127
}
3228

3329
function openLightbox() {

app/directives/challenge-user-place/challenge-user-place.directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
if (!$scope.challenge.isPrivate && $scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
4747
$scope.selectedIndex = 0;
4848
$scope.challenge.thumbnailId = $scope.challenge.userDetails.submissions[0].id;
49-
$scope.imageURL = $scope.challenge.userDetails.submissions[0].fullImage;
49+
$scope.imageURL = $scope.challenge.userDetails.submissions[0].submissionImage;
5050
$scope.selectedImage = $scope.imageURL;
5151

5252
$scope.challenge.highestPlacement = _.max($scope.challenge.userDetails.submissions, 'placement').placement;

app/directives/challenge-user-place/design-lightbox/design-lightbox.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
.selections
1616
img.selection(
1717
ng-repeat="submission in challenge.userDetails.submissions",
18-
ng-src="{{submission.fullImage}}",
19-
ng-click="updateSelected(submission.fullImage, $index)",
20-
ng-class="{'current': submission.fullImage == selectedImage}"
18+
ng-src="{{submission.submissionImage}}",
19+
ng-click="updateSelected(submission.submissionImage, $index)",
20+
ng-class="{'current': submission.submissionImage == selectedImage}"
2121
)
2222

2323
.right-nav

app/directives/distribution-graph/distribution-graph.directive.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
.num {{rating}}
1212
.label RATING
1313
button.tc-btn.tc-btn-s.compare(ng-click="graphState.show = 'history'")
14-
| BACK TO YOUR RATING
14+
| View Rating History
1515

app/directives/empty-state-placeholder/empty-state-placeholder.directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
});
2424
scope.transcluded = angular.element(contentDiv)[0].children.length > 0;
2525
},
26-
controller: ['$scope', 'CONSTANTS', '$attrs', '$element',
27-
function($scope, CONSTANTS, $attrs, $element) {
26+
controller: ['$scope', '$attrs', '$element',
27+
function($scope, $attrs, $element) {
2828
$scope.DOMAIN = CONSTANTS.domain;
2929
var vm = this;
3030
vm.title = null;
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/* jshint -W117, -W030 */
2+
describe('Empty State Placeholder Directive', function() {
3+
var scope;
4+
var element;
5+
var emptyStateService;
6+
var stateToTest = null;
7+
var stateToTestName = "dashboard-challenges";
8+
9+
beforeEach(function() {
10+
bard.appModule('topcoder');
11+
bard.inject(this, '$compile', '$rootScope', 'EmptyStateService');
12+
emptyStateService = EmptyStateService;
13+
stateToTest = emptyStateService.getState(stateToTestName);
14+
});
15+
16+
bard.verifyNoOutstandingHttpRequests();
17+
18+
describe('Without transcluded content', function() {
19+
var emptyState;
20+
21+
beforeEach(function() {
22+
scope = $rootScope.$new();
23+
scope.show = true;
24+
scope.theme = 'black';
25+
scope.stateName = stateToTestName;
26+
element = angular.element('<empty-state-placeholder state-name="{{stateName}}" theme="{{theme}}" show="show"></empty-state-placeholder>)');
27+
emptyState = $compile(element)(scope);
28+
scope.$digest();
29+
controller = element.controller('emptyStatePlaceholder');
30+
});
31+
32+
it('should have found a valid empty state', function() {
33+
expect(controller.title).to.exist.to.equal(stateToTest.title);
34+
expect(controller.description).to.exist.to.equal(stateToTest.description);
35+
expect(controller.helpLinks).to.exist;
36+
expect(controller.helpLinks.length).to.equal(stateToTest.helpLinks.length);
37+
});
38+
39+
it('should have valid visibilty state', function() {
40+
expect(controller.show).to.exist.to.equal(true);
41+
expect(controller.theme).to.exist.to.equal('black');
42+
});
43+
44+
it('should have valid transcluded state', function() {
45+
expect(element.isolateScope().transcluded).to.exist.to.equal(false);
46+
});
47+
48+
it('should watch changes in show param expression', function() {
49+
expect(controller.show).to.exist.to.equal(true);
50+
// update the show variable expression
51+
scope.show = false;
52+
scope.$digest();
53+
// should update controller's state
54+
expect(controller.show).to.exist.to.equal(false);
55+
});
56+
});
57+
58+
describe('With transcluded content', function() {
59+
var emptyState;
60+
61+
beforeEach(function() {
62+
scope = $rootScope.$new();
63+
scope.show = true;
64+
scope.theme = 'black';
65+
scope.stateName = stateToTestName;
66+
element = angular.element('<empty-state-placeholder state-name="{{stateName}}" theme="{{theme}}" show="show"><span>Test</span></empty-state-placeholder>)');
67+
emptyState = $compile(element)(scope);
68+
scope.$digest();
69+
controller = element.controller('emptyStatePlaceholder');
70+
});
71+
72+
it('should have found a valid empty state', function() {
73+
expect(controller.title).to.exist.to.equal(stateToTest.title);
74+
expect(controller.description).to.exist.to.equal(stateToTest.description);
75+
expect(controller.helpLinks).to.exist;
76+
expect(controller.helpLinks.length).to.equal(stateToTest.helpLinks.length);
77+
});
78+
79+
it('should have valid visibilty state', function() {
80+
expect(controller.show).to.exist.to.equal(true);
81+
expect(controller.theme).to.exist.to.equal('black');
82+
});
83+
84+
it('should have valid transcluded state', function() {
85+
expect(element.isolateScope().transcluded).to.exist.to.equal(true);
86+
});
87+
88+
it('should watch changes in show param expression', function() {
89+
expect(controller.show).to.exist.to.equal(true);
90+
// update the show variable expression
91+
scope.show = false;
92+
scope.$digest();
93+
// should update controller's state
94+
expect(controller.show).to.exist.to.equal(false);
95+
});
96+
});
97+
});
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
.ext-tile(ng-repeat="account in accountList | orderBy:'order'", ng-click="!account.disabled && !readOnly && handleClick(account.provider, account.status)", ng-class="{'connected': account.status === 'linked', 'connecting': account.status === 'pending', 'disabled': account.disabled, 'enabled': !account.disabled, 'read-only': readOnly, 'connect': account.status === 'unlinked' && !account.disabled}")
1+
.ext-tile(ng-repeat="account in accountList | orderBy:'order'", ng-click="!account.disabled && !readOnly && handleClick(account.provider, account.status)", ng-class="{'connected': !readOnly && account.status === 'linked', 'connecting': !readOnly && account.status === 'pending', 'disabled': account.disabled, 'enabled': !readOnly && !account.disabled, 'read-only': readOnly, 'connect': !readOnly && account.status === 'unlinked' && !account.disabled}", ng-if="!readOnly || account.featured === true")
22
.external-account-box(ng-class="account.colorClass")
33
i.fa(ng-class="account.className")
44

55
.provider {{account.displayName}}
66

7-
.status.already-connected(ng-if="account.status === 'linked'") Connected
7+
.status.already-connected(ng-if="!readOnly && account.status === 'linked'") Connected
88

9-
.status.already-connected(ng-if="account.status === 'pending'") Connecting
9+
.status.already-connected(ng-if="!readOnly && account.status === 'pending'") Connecting
1010

1111
.status.disconnect Disconnect
1212

13-
.status(ng-if="account.status === 'unlinked' && !account.disabled") Connect
13+
.status(ng-if="!readOnly && account.status === 'unlinked' && !account.disabled") Connect
1414

15-
.status(ng-if="account.disabled") Coming Soon
15+
.status(ng-if="!readOnly && account.disabled") Coming Soon

app/directives/external-account/external-account.directive.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
(function() {
22
'use strict';
33
var _supportedAccounts = [
4-
{ provider: "dribbble", className: "fa-dribbble", displayName: "Dribbble", disabled: false, order: 6, colorClass: 'el-dribble'},
5-
{ provider: "linkedin", className: "fa-linkedin", displayName: "LinkedIn", disabled: true, order: 5, colorClass: 'el-linkedin'},
4+
{ provider: "dribbble", className: "fa-dribbble", displayName: "Dribbble", disabled: false, order: 6, colorClass: 'el-dribble', featured: true},
5+
{ provider: "linkedin", className: "fa-linkedin", displayName: "LinkedIn", disabled: true, order: 5, colorClass: 'el-linkedin', featured: true},
66
{ provider: "stackoverflow", className: "fa-stack-overflow", displayName: "Stack Overflow", disabled: false, order: 3, colorClass: 'el-stackoverflow'},
77
{ provider: "behance", className: "fa-behance", displayName: "Behance", disabled: true, order: 2, colorClass: 'el-behance'},
88
// { provider: "google-oauth2", className: "fa-google-plus", displayName: "Google+", disabled: true, order: }, colorClass: 'el-dribble',
9-
{ provider: "github", className: "fa-github", displayName: "Github", disabled: false, order: 1, colorClass: 'el-github'},
9+
{ provider: "github", className: "fa-github", displayName: "Github", disabled: false, order: 1, colorClass: 'el-github', featured: true},
1010
{ provider: "bitbucket", className: "fa-bitbucket", displayName: "Bitbucket", disabled: false, order: 7, colorClass: 'el-bitbucket'},
1111
{ provider: "twitter", className: "fa-twitter", displayName: "Twitter", disabled: true, order: 4, colorClass: 'el-twitter'},
1212
{ provider: "weblinks", className: "fa-globe", displayName: "Web Links", disabled: true, order: 8, colorClass: 'el-weblinks'}

app/directives/focus-on.directive.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
var model = $parse(attr.focusOn);
1111
scope.$watch(model, function(newValue) {
1212
$timeout(function() {
13-
if (newValue !== undefined) {
13+
14+
if (newValue !== undefined && newValue) {
1415
element[0].focus();
16+
} else {
17+
element[0].blur();
1518
}
1619
}, 0);
1720
});

app/directives/history-graph/history-graph.directive.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
.history-info
1111
.challenge(ng-if="historyRating") {{historyChallenge}}
1212
.date(ng-if="historyRating") {{historyDate | date}}
13-
button.tc-btn.tc-btn-s.compare(ng-click="graphState.show = 'distribution'") COMMUNITY RATINGS
13+
button.tc-btn.tc-btn-s.compare(ng-click="graphState.show = 'distribution'") View Rating Distribution

app/directives/profile-widget/profile-widget.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
.info
77
h1.handle(style="color:{{handleColor}};") {{profile.handle}}
88

9-
h3.location-challenges {{profile.homeCountryCode | isoCountry}}
10-
span.bar(ng-show="profile.homeCountryCode && numWins") &nbsp;|&nbsp;
9+
h3.location-challenges {{profile.competitionCountryCode | isoCountry}}
10+
span.bar(ng-show="profile.competitionCountryCode && numWins") &nbsp;|&nbsp;
1111
span(ng-show="numWins") {{numWins}} Wins
1212

1313
h3.tenure(ng-if="profile.startMonth")

app/directives/srm-tile/srm-tile.directive.jade

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
span.time-zone {{srm.codingStartAt | localTime:"z" }}
1616

1717
.phase-status
18-
.registered(ng-show="vm.registered")
19-
i.fa.fa-check-circle-o
20-
p You are registered!
21-
.unregistered(ng-hide="vm.registered")
22-
button.tc-btn.tc-btn-s.tc-btn-wide.srm-action Register
18+
.registered(ng-show="srm.userStatus === CONSTANTS.REGISTERED") Registered
19+
.unregistered(ng-hide="srm.currentPhase !== CONSTANTS.REGISTRATION || srm.userStatus === CONSTANTS.REGISTERED")
20+
a.tc-btn.tc-btn-s.tc-btn-wide(href="https://community.{{DOMAIN}}/tc?module=MatchDetails&rd={{srm.rounds[0].id}}") Register
2321

2422
.past-srm(ng-show="srm.status === 'PAST'")
2523
.challenge-track
@@ -48,13 +46,11 @@
4846

4947
.srm-details
5048
p.starts-in Starts in #[span {{srm.codingStartAt | timeDiff:"quantity"}} {{srm.codingStartAt | timeDiff:'unit'}}]
51-
49+
5250
.phase-status
53-
.registered(ng-show="vm.registered")
54-
i.fa.fa-check-circle-o
55-
p You are registered!
56-
.unregistered(ng-hide="vm.registered")
57-
button.tc-btn.tc-btn-s.tc-btn-wide.srm-action Register
51+
.registered(ng-show="srm.userStatus === CONSTANTS.REGISTERED") Registered
52+
.unregistered(ng-hide="srm.currentPhase !== CONSTANTS.REGISTRATION || srm.userStatus === CONSTANTS.REGISTERED")
53+
a.tc-btn.tc-btn-s.tc-btn-wide(href="https://community.{{DOMAIN}}/tc?module=MatchDetails&rd={{srm.rounds[0].id}}") Register
5854

5955
.past-srm(ng-show="srm.status === 'PAST'")
6056
.challenge-track

app/directives/srm-tile/srm-tile.directive.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,12 @@
1010
showResults: '=',
1111
showFooter: '='
1212
},
13-
controller: ['$scope', 'CONSTANTS', function($scope, CONSTANTS) {
13+
controller: ['$scope', '$filter', 'CONSTANTS', 'SRMService',
14+
function($scope, $filter, CONSTANTS, SRMService) {
1415
$scope.DOMAIN = CONSTANTS.domain;
15-
// TODO removed hard coded value
16-
$scope.registered = false;
17-
if (Array.isArray($scope.srm.rounds) && $scope.srm.rounds.length) {
18-
if ($scope.srm.rounds[0].userSRMDetails && $scope.srm.rounds[0].userSRMDetails.rated) {
19-
$scope.srm.result = $scope.srm.rounds[0].userSRMDetails;
20-
}
21-
if ($scope.srm.rounds[0].codingStartAt) {
22-
$scope.srm.codingStartAt = $scope.srm.rounds[0].codingStartAt;
23-
}
24-
if ($scope.srm.rounds[0].codingEndAt) {
25-
$scope.srm.codingEndAt = $scope.srm.rounds[0].codingEndAt;
26-
}
27-
}
16+
$scope.CONSTANTS = CONSTANTS;
17+
$scope.srm.userStatus = _.get($scope.srm, 'userStatus', null);
18+
SRMService.processSRM($scope.srm);
2819
}]
2920
};
3021
});

0 commit comments

Comments
 (0)