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

Commit 51519bf

Browse files
author
Parth Shah
committed
Merge branch 'release/v1.0.10'
2 parents f4a5e2f + 782cea6 commit 51519bf

File tree

108 files changed

+666
-464
lines changed

Some content is hidden

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

108 files changed

+666
-464
lines changed

app/account/account.routes.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,13 @@
108108
},
109109
logout: {
110110
url: '/logout/',
111-
controller: ['TcAuthService', function(TcAuthService) {
112-
TcAuthService.logout();
113-
}],
111+
views: {
112+
'header@': {},
113+
'container@': {
114+
controller: 'LogoutController'
115+
},
116+
'footer@': {}
117+
},
114118
data: {
115119
authRequired: false
116120
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tc.account').controller('LogoutController', LogoutController);
5+
6+
LogoutController.$inject = ['$log', 'TcAuthService', '$window', 'CONSTANTS'];
7+
8+
function LogoutController($log, TcAuthService, $window, CONSTANTS) {
9+
$log = $log.getInstance('LogoutController');
10+
11+
TcAuthService.logout()
12+
.then(function() {
13+
$log.debug("successfully logged out.");
14+
// redirect to home
15+
$window.location.href = CONSTANTS.MAIN_URL;
16+
});
17+
18+
}
19+
})();
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* jshint -W117, -W030 */
2+
describe('Logout Controller', function() {
3+
var controller;
4+
var fakeWindow = {
5+
location: {
6+
href: ''
7+
}
8+
};
9+
10+
11+
beforeEach(function() {
12+
bard.appModule('topcoder');
13+
bard.appModule('tc.account');
14+
module('tc.account', function($provide) {
15+
$provide.value('$window', fakeWindow);
16+
});
17+
18+
bard.inject(this, '$controller', 'TcAuthService', '$window', '$q', 'CONSTANTS');
19+
20+
bard.mockService(TcAuthService, {
21+
logout: $q.when({}),
22+
_default: $q.when({})
23+
});
24+
25+
controller = $controller('LogoutController');
26+
});
27+
28+
bard.verifyNoOutstandingHttpRequests();
29+
30+
it('should be defined', function() {
31+
expect(controller).to.be.defined;
32+
});
33+
34+
it('should be successfully logged out', function() {
35+
expect(TcAuthService.logout).to.have.been.calledOnce;
36+
expect($window.location.href).to.equal(CONSTANTS.MAIN_URL);
37+
});
38+
39+
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
$scope.selectedIndex += x;
7171
if ($scope.selectedIndex < 0) $scope.selectedIndex = $scope.challenge.userDetails.submissions.length - 1;
7272
if ($scope.selectedIndex == $scope.challenge.userDetails.submissions.length) $scope.selectedIndex = 0;
73-
$scope.selectedImage = $scope.challenge.userDetails.submissions[$scope.selectedIndex].fullImage;
73+
$scope.selectedImage = $scope.challenge.userDetails.submissions[$scope.selectedIndex].submissionImage && $scope.challenge.userDetails.submissions[$scope.selectedIndex].submissionImage.full;
7474
}
7575

7676
function openLightbox() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.lightbox-container
22
.left-nav
3-
img(src="/images/ico-arrow-big-left.svg", ng-click="incrementIndex(-1)")
3+
img(ng-show="challenge.userDetails.submissions.length > 1", src="/images/ico-arrow-big-left.svg", ng-click="incrementIndex(-1)")
44

55
.selector
66
.title {{challenge.name}}
@@ -25,6 +25,6 @@
2525
)
2626

2727
.right-nav
28-
img(src="/images/ico-arrow-big-right.svg", ng-click="incrementIndex(1)")
28+
img(ng-show="challenge.userDetails.submissions.length > 1", src="/images/ico-arrow-big-right.svg", ng-click="incrementIndex(1)")
2929

3030
// img(ng-src="http://studio.{{DOMAIN}}/studio.jpg?module=DownloadSubmission&sbmid={{challenge.thumbnailId}}&sbt=full", fallback-src="/images/ico-picture.svg")

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@
7676
toaster.pop('error', "Whoops!",
7777
String.supplant(
7878
"This {provider} account is linked to another account. \
79-
If you think this is an error please contact <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>.",
79+
If you think this is an error please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>.",
8080
{provider: provider.displayName }
8181
)
8282
);
83+
} else {
84+
$log.error("Fatal Error: _link: " + resp.msg);
85+
toaster.pop('error', "Whoops!", "Sorry, we are unable to add your account right now. Please try again later. If the problem persists, please contact <a href=\"mailTo:[email protected]\">[email protected]</a>.");
8386
}
8487
});
8588
}
@@ -105,10 +108,10 @@
105108
var msg = resp.msg;
106109
if (resp.status === 'SOCIAL_PROFILE_NOT_EXIST') {
107110
$log.info("Social profile not linked to account");
108-
msg = "{provider} account is not linked to your account. If you think this is an error please contact <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>.";
111+
msg = "{provider} account is not linked to your account. If you think this is an error please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>.";
109112
} else {
110-
$log.info("Fatal error: " + msg);
111-
msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>";
113+
$log.error("Fatal error: _unlink: " + msg);
114+
msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>";
112115
}
113116
toaster.pop('error', "Whoops!", String.supplant(msg, {provider: provider.displayName }));
114117
});

app/directives/header/header-menu-item.directive.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ li.submenu-item(ng-if="item.sref && !item.srefParams")
66

77
// external links
88
li.submenu-item(ng-if="item.href && !item.srefParams")
9-
a.menu-link(ng-click="$event.stopPropagation();" ng-href="{{item.href}}" ng-class="{ 'active': isActive() }" target="{{ item.target ? item.target : '_self'}}")
9+
a.menu-link(ng-href="{{item.href}}" ng-class="{ 'active': isActive() }" target="{{ item.target ? item.target : '_self'}}")
1010
img.menu-icon(ng-src="{{item.icon}}")
1111
.menu-text {{item.text}}
1212

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.profile-widget-directive
2-
a(ui-sref="profile.about({userHandle: profile.handle})")
2+
.pic
33
img.profile-circle(ng-if="profile.photoURL", ng-src="{{profile.photoURL}}")
44
img.profile-circle(ng-if="!profile.photoURL", src="/images/ico-user-default.svg")
55

app/filters/track.filter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
var map = {
1111
'UI_PROTOTYPE_COMPETITION': 'UI Prototype Competition',
12+
'ASSEMBLY_COMPETITION': 'ASSEMBLY',
1213
'RIA_BUILD_COMPETITION': 'RIA Build Competition',
1314
'RIA_COMPONENT_COMPETITION': 'RIA Component Competition',
1415
'DEVELOP_MARATHON_MATCH': 'Marathon Match',

app/filters/underscore-strip.filter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
function underscoreStrip() {
77
return function(string) {
8+
var map = {
9+
'ASSEMBLY_COMPETITION': 'ASSEMBLY'
10+
};
11+
if (map[string]) {
12+
return map[string];
13+
}
814
if (!string) {
915
return '';
1016
}

app/index.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ html
2727
2828
// build:css /styles/app.css
2929
//- inject:css
30-
link(rel="stylesheet", href="assets/css/reset.css")
3130
link(rel="stylesheet", href="assets/css/vendors/angucomplete.css")
3231
link(rel="stylesheet", href="assets/css/topcoder.css")
3332
link(rel="stylesheet", href="assets/css/skill-picker/skill-picker.css")
@@ -72,7 +71,6 @@ html
7271
link(rel="stylesheet", href="assets/css/directives/profile-widget.css")
7372
link(rel="stylesheet", href="assets/css/directives/page-state-header.directive.css")
7473
link(rel="stylesheet", href="assets/css/directives/ios-card.css")
75-
link(rel="stylesheet", href="assets/css/directives/input-sticky-placeholder.css")
7674
link(rel="stylesheet", href="assets/css/directives/history-graph.css")
7775
link(rel="stylesheet", href="assets/css/directives/external-link-data.css")
7876
link(rel="stylesheet", href="assets/css/directives/external-account.css")
@@ -86,6 +84,7 @@ html
8684
link(rel="stylesheet", href="assets/css/directives/badge-tooltip.css")
8785
link(rel="stylesheet", href="assets/css/community/statistics.css")
8886
link(rel="stylesheet", href="assets/css/community/members.css")
87+
link(rel="stylesheet", href="assets/css/community/community.css")
8988
link(rel="stylesheet", href="assets/css/account/reset-password.css")
9089
link(rel="stylesheet", href="assets/css/account/registered-successfully.css")
9190
link(rel="stylesheet", href="assets/css/account/register.css")
@@ -166,6 +165,7 @@ html
166165
script(src="account/account.module.js")
167166
script(src="account/account.routes.js")
168167
script(src="account/login/login.controller.js")
168+
script(src="account/logout/logout.controller.js")
169169
script(src="account/register/register.controller.js")
170170
script(src="account/reset-password/reset-password.controller.js")
171171
script(src="blocks/exception/exception.module.js")

app/layout/header/header.controller.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
vm.constants = CONSTANTS;
1212
vm.domain = CONSTANTS.domain;
1313
vm.login = TcAuthService.login;
14-
vm.logout = logout;
1514
vm.checkSubmit = checkSubmit;
1615
vm.searchTerm = '';
1716
vm.selectedGroup = selectedGroup;
@@ -65,13 +64,6 @@
6564
}
6665
}
6766

68-
function logout() {
69-
TcAuthService.logout()
70-
.then(function() {
71-
$state.go('home');
72-
});
73-
}
74-
7567
function selectedGroup() {
7668
return _.get(NavService, 'selectedTopLevelItem', null);
7769
}

app/layout/header/header.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
header-menu-item(ng-repeat="item in vm.userMenu" item="item")
5050

5151
li.submenu-item
52-
a.menu-link(ng-click="vm.logout(); main.menuVisible = vm.isAuth = false")
52+
//- a.menu-link(ng-click="vm.logout(); main.menuVisible = vm.isAuth = false")
53+
a.menu-link(ui-sref="logout")
5354
img.menu-icon(ng-src="/images/nav/exit.svg")
5455
.menu-text LOG OUT
5556

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
ChallengeService.getUserMarathonMatches(handle, marathonMatchParams),
4040
ChallengeService.getUserChallenges(handle, challengeParams)
4141
]).then(function(challenges){
42-
console.log('challenges: ', challenges);
4342
var marathonMatches = challenges[0];
4443
var devDesignChallenges = challenges[1];
4544

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
filter: "platforms=ios&technologies=swift&status=active",
6868
limit: 3,
6969
offset: 0,
70-
orderBy: 'submissionEndDate desc'
70+
orderBy: 'submissionEndDate asc'
7171
}).then(function(challenges) {
7272
if (challenges.length > 0) {
7373
vm.challenges = challenges.slice(0, 3);

app/my-dashboard/srms/srms.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ tc-section(state="vm.state")
1212
.flex-wrapper
1313
h2 Practice on past problems
1414

15-
a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost(ng-href="https://community.{{DOMAIN}}/tc?module=ProblemArchive") Problem Archives
15+
a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost(ng-href="https://arena.{{DOMAIN}}/#/u/practiceProblemList") Practice Problems
1616

17-
a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost(ng-href="https://community.{{DOMAIN}}/wiki/display/tc/Algorithm+Problem+Set+Analysis") Match Editorials
17+
a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost(ng-href="https://community.{{DOMAIN}}/tc?module=ProblemArchive") Problem Archive
1818

1919
a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost(ng-href="https://www.{{DOMAIN}}/member-onboarding/learning-practicing-skills/") Learn More
2020

app/my-dashboard/subtrack-stats/subtrack-stats.controller.js

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

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

6-
SubtrackStatsController.$inject = ['$filter', 'ProfileService', 'userIdentity'];
6+
SubtrackStatsController.$inject = ['$filter', 'ProfileService', 'UserStatsService', 'userIdentity'];
77

8-
function SubtrackStatsController($filter, ProfileService, userIdentity) {
8+
function SubtrackStatsController($filter, ProfileService, UserStatsService, userIdentity) {
99
var vm = this;
1010
vm.loading = true;
1111

@@ -17,11 +17,14 @@
1717
ProfileService.getUserStats(vm.handle)
1818
.then(function(stats) {
1919
var trackRanks = ProfileService.getRanks(stats);
20-
var subtrackRanks = compileSubtracks(trackRanks);
20+
var subtrackRanks = UserStatsService.compileSubtracks(trackRanks);
2121

22-
processStats(subtrackRanks);
22+
UserStatsService.processStats(subtrackRanks);
23+
// filter stats based on processing done above
24+
// filtering is a separate step to allow multiple pre-processings and filter out in single call
25+
subtrackRanks = UserStatsService.filterStats(subtrackRanks);
2326
// sort subtrack ranks
24-
subtrackRanks = $filter('orderBy')(subtrackRanks, 'mostRecentEventDate', true);
27+
subtrackRanks = $filter('orderBy')(subtrackRanks, 'mostRecentSubmissionDate', true);
2528

2629
vm.subtrackRanks = subtrackRanks;
2730
vm.hasRanks = !!vm.subtrackRanks.length;
@@ -33,37 +36,5 @@
3336
vm.loading = false;
3437
});
3538
}
36-
37-
function compileSubtracks(trackRanks) {
38-
return _.reduce(trackRanks, function(result, subtracks, track) {
39-
if (Array.isArray(subtracks) && subtracks.length) {
40-
if (track === 'DEVELOP') {
41-
_.remove(subtracks, function(subtrackObj) {
42-
return subtrackObj.subTrack === 'COPILOT_POSTING';
43-
});
44-
}
45-
46-
return result.concat(subtracks);
47-
48-
} else {
49-
return result;
50-
}
51-
}, []);
52-
}
53-
54-
function processStats(subtrackRanks) {
55-
angular.forEach(subtrackRanks, function(subtrack) {
56-
if (subtrack.track === 'DESIGN') {
57-
subtrack.stat = subtrack.wins;
58-
subtrack.statType = 'Wins';
59-
} else if (subtrack.track === 'COPILOT') {
60-
subtrack.stat = subtrack.activeContests;
61-
subtrack.statType = 'Challenges';
62-
} else {
63-
subtrack.stat = subtrack.rating;
64-
subtrack.statType = 'Rating';
65-
}
66-
});
67-
}
6839
}
6940
})();

app/profile/about/about.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
vm.categories = profileVm.categories;
6262
vm.marathonRating = profileVm.categories['MARATHON_MATCH'] && profileVm.categories['MARATHON_MATCH'].rating;
6363
vm.SRMRating = profileVm.categories['SRM'] && profileVm.categories['SRM'].rating;
64-
vm.displaySection.stats = profileVm.showEditProfileLink || _.get(vm, 'categories.DESIGN', []).length || _.get(vm, 'categories.DEVELOP', []).length || _.get(vm, 'categories.DATA_SCIENCE', []).length || _.get(vm, 'categories.COPILOT', []).length;
64+
vm.displaySection.stats = profileVm.showEditProfileLink;
6565
});
6666

6767
profileVm.skillsPromise.then(function() {

app/profile/about/about.jade

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
.empty-profile
1414
.empty-state
15-
empty-state-placeholder(state-name="profile-empty", show="profileVm.status.skills === 'ready' && profileVm.status.stats === 'ready' && profileVm.status.externalLinks === 'ready' && !profileVm.showEditProfileLink && !profileVm.numProjects && (!profileVm.skills || (profileVm.skills && profileVm.skills.length == 0)) && !vm.hasLinks")
15+
empty-state-placeholder(state-name="profile-empty", show="profileVm.status.skills === 'ready' && profileVm.status.stats === 'ready' && profileVm.status.externalLinks === 'ready' && !profileVm.showEditProfileLink && !profileVm.showTCActivity && (!profileVm.skills || (profileVm.skills && profileVm.skills.length == 0)) && !vm.hasLinks")
1616
.sample-image
1717
img(ng-src="/images/robot.svg")
1818

@@ -39,16 +39,16 @@
3939

4040

4141
#tcActivity
42-
tc-section(ng-show="vm.displaySection.stats", state="profileVm.status.stats")
42+
tc-section(ng-show="vm.displaySection.stats || profileVm.showTCActivity", state="profileVm.status.stats")
4343

4444
.categories
4545

4646
.empty-state
47-
empty-state-placeholder(state-name="profile-topcoder-activity", show="!profileVm.numProjects", theme="offwhite")
47+
empty-state-placeholder(state-name="profile-topcoder-activity", show="!profileVm.showTCActivity", theme="offwhite")
4848

4949
.track(
5050
ng-repeat="track in profileVm.profile.tracks",
51-
ng-if="profileVm.categories[track].length > 0",
51+
ng-if="profileVm.categories[track].showTrack",
5252
id="{{track}}_TRACK"
5353
)
5454

@@ -63,21 +63,22 @@
6363
ng-repeat="subtrack in profileVm.categories[track] | orderBy:'mostRecentEventDate':true",
6464
ui-sref="profile.subtrack({track: subtrack.track, subTrack: subtrack.subTrack})",
6565
class="{{$index == 0 && 'first'}}"
66+
ng-if="subtrack.showStats"
6667
)
6768
.name {{subtrack.subTrack | track}}
6869

69-
.ranking(ng-if="subtrack.rating")
70+
.ranking(ng-if="subtrack.statType == 'Rating'")
7071
.number.rating(style="color: {{subtrack.rating | ratingColor}}")
7172
| {{subtrack.rating}}
7273

7374
.tag Rating
7475

75-
.ranking(ng-if="subtrack.rank && !subtrack.rating")
76+
.ranking(ng-if="subtrack.statType == 'Ranking'")
7677
.number {{subtrack.rank | ordinal}}
7778

7879
.tag Ranking
7980

80-
.ranking(ng-if="subtrack.wins && !subtrack.rank && !subtrack.rating")
81+
.ranking(ng-if="subtrack.statType === 'Wins'")
8182
.number(style="color: #21B2F1") {{subtrack.wins}}
8283

8384
.tag Wins

0 commit comments

Comments
 (0)