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

Commit 5732771

Browse files
author
TonyJ
committed
Merge branch 'dev' into feature/member-page-updates
2 parents 11cf01b + 88730ab commit 5732771

Some content is hidden

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

48 files changed

+353
-266
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/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-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

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/page-state-header/page-state-header.directive.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
hideMoney: '=',
1414
defaultState: '@'
1515
},
16-
controller: ['$scope', 'NotificationService', 'ProfileService', '$log', '$state', pageStateHeader],
16+
controller: ['CONSTANTS', '$rootScope', '$scope', 'NotificationService', 'ProfileService', '$log', '$state', pageStateHeader],
1717
controllerAs: "vm"
1818
};
1919
});
2020

21-
function pageStateHeader($scope, NotificationService, ProfileService, $log, $state) {
21+
function pageStateHeader(CONSTANTS, $rootScope, $scope, NotificationService, ProfileService, $log, $state) {
2222
var vm = this;
2323
vm.handle = $scope.handle;
2424
vm.profile = null;
@@ -31,12 +31,16 @@
3131
vm.backHandler = backHandler;
3232
activate();
3333

34+
// watch for profile update event in case handle/image are updated
35+
$rootScope.$on(CONSTANTS.EVENT_PROFILE_UPDATED, function() {
36+
activate();
37+
});
38+
3439
function activate() {
3540
vm.loading = true;
3641

3742
// identifies the previous state
3843
if ($scope.$root.previousState && $scope.$root.previousState.name.length > 0) {
39-
console.log($scope.$root.previousState);
4044
vm.previousState = $scope.$root.previousState;
4145
vm.previousStateName = vm.previousState.name;
4246
} else if ($scope.defaultState) {

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
});

app/index.jade

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ html
174174
script(src="blocks/logger/logEnhancer.js")
175175
script(src="blocks/logger/logger.js")
176176
script(src="community/community.module.js")
177-
script(src="community/community.controller.js")
178177
script(src="community/community.routes.js")
179178
script(src="community/members.controller.js")
180179
script(src="community/statistics.controller.js")
@@ -266,8 +265,8 @@ html
266265
script(src="services/authtoken.service.js")
267266
script(src="services/blog.service.js")
268267
script(src="services/challenge.service.js")
269-
script(src="services/emptyState.service.js")
270268
script(src="services/communityData.service.js")
269+
script(src="services/emptyState.service.js")
271270
script(src="services/externalAccounts.service.js")
272271
script(src="services/helpers.service.js")
273272
script(src="services/image.service.js")

app/layout/header/header.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
angular.forEach([
3333
CONSTANTS.EVENT_USER_LOGGED_IN,
3434
CONSTANTS.EVENT_USER_LOGGED_OUT,
35+
CONSTANTS.EVENT_PROFILE_UPDATED
3536
], function(event) {
3637
$rootScope.$on(event, function() {
3738
initHeaderProps(event);

app/layout/header/header.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
span(ng-switch-when="false" class="tc-btn tc-btn-s") JOIN
1919

2020
ul.main-menu
21-
li.menu-item.search-wrapper
21+
li.menu-item.search-wrapper(ng-mouseenter="vm.focusSearch = true", ng-mouseleave="vm.focusSearch = false")
2222
.menu-item-header.show-large #[button.btn-expand-search.search-icon(type="button")]
2323

2424
.submenu
25-
input(type="text" placeholder="find people" ng-model="vm.searchTerm" ng-keyup="vm.checkSubmit($event)")
25+
input(type="text" placeholder="find members" ng-model="vm.searchTerm" ng-keyup="vm.checkSubmit($event)", focus-on="vm.focusSearch")
2626
// Suggestion list container
2727
// ul.suggestion-list(ng-if="main.searchTerm.length > 0")
2828
// li(ng-repeat="suggestion in main.suggestions | filter:main.searchTerm | limitTo:5")

app/my-dashboard/srms/srms.controller.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33

44
angular.module('tc.myDashboard').controller('SRMWidgetController', SRMWidgetController);
55

6-
SRMWidgetController.$inject = ['UserService','SRMService', '$log'];
6+
SRMWidgetController.$inject = ['CONSTANTS', 'UserService','SRMService', '$q', '$log'];
77

8-
function SRMWidgetController(UserService, SRMService, $log) {
8+
function SRMWidgetController(CONSTANTS, UserService, SRMService, $q, $log) {
99
var vm = this;
1010
vm.srms = [];
11-
vm.loading = true;
11+
vm.state = CONSTANTS.STATE_LOADING;
1212

1313
var userId = UserService.getUserIdentity().userId;
14+
var handle = UserService.getUserIdentity().handle;
1415

1516
activate();
1617

@@ -24,14 +25,32 @@
2425
limit: 3
2526
};
2627

27-
SRMService.getSRMs(params)
28-
.then(function(data){
29-
vm.srms = data;
30-
vm.loading = false;
31-
}, function(resp) {
28+
$q.all([
29+
SRMService.getSRMs(params),
30+
// passing same params for user srms too, because it is highly unlikely that a member is registered
31+
// for more than 3 SRMs at a time as we don't have more than 3 active SRMs at the same time.
32+
SRMService.getUserSRMs(handle, params)
33+
]).then(function(data) {
34+
var srms = data[0];
35+
var userSrms = data[1];
36+
var userSrmsMap = {};
37+
var userSrms = userSrms.forEach(function (srm) {
38+
var id = srm.id;
39+
userSrmsMap[id] = srm;
40+
});
41+
// populates a map of user's future SRMs
42+
srms.forEach(function(srm) {
43+
if (userSrmsMap[srm.id]) {
44+
srm.userStatus = CONSTANTS.REGISTERED;
45+
}
46+
});
47+
48+
vm.srms = srms;
49+
vm.state = CONSTANTS.STATE_READY;
50+
}).catch(function(error) {
3251
// TODO - handle error
3352
$log.error(resp);
34-
vm.loading = false;
53+
vm.state = CONSTANTS.STATE_ERROR;
3554
});
3655
}
3756
}

app/my-dashboard/srms/srms.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ header
44

55
.section-loading(ng-show="vm.loading")
66

7-
section(ng-hide="vm.loading")
7+
tc-section(state="vm.state")
88
.srm-tiles
99
srm-tile(ng-repeat="srm in vm.srms", srm="srm", view="'tile'", ng-class="'tile-view'")
1010

0 commit comments

Comments
 (0)