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

Commit 2cf394d

Browse files
author
Nick Litwin
committed
Fix merge conflicts and tech review changes
2 parents 4e6e090 + b757d55 commit 2cf394d

File tree

105 files changed

+868
-540
lines changed

Some content is hidden

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

105 files changed

+868
-540
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/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/index.jade

Lines changed: 3 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")
@@ -38,6 +37,7 @@ html
3837
link(rel="stylesheet", href="assets/css/settings/edit-profile.css")
3938
link(rel="stylesheet", href="assets/css/settings/account-info.css")
4039
link(rel="stylesheet", href="assets/css/profile/subtrack.css")
40+
link(rel="stylesheet", href="assets/css/profile/nav.css")
4141
link(rel="stylesheet", href="assets/css/profile/icons.css")
4242
link(rel="stylesheet", href="assets/css/profile/header.css")
4343
link(rel="stylesheet", href="assets/css/profile/badges.css")
@@ -72,7 +72,6 @@ html
7272
link(rel="stylesheet", href="assets/css/directives/profile-widget.css")
7373
link(rel="stylesheet", href="assets/css/directives/page-state-header.directive.css")
7474
link(rel="stylesheet", href="assets/css/directives/ios-card.css")
75-
link(rel="stylesheet", href="assets/css/directives/input-sticky-placeholder.css")
7675
link(rel="stylesheet", href="assets/css/directives/history-graph.css")
7776
link(rel="stylesheet", href="assets/css/directives/external-link-data.css")
7877
link(rel="stylesheet", href="assets/css/directives/external-account.css")
@@ -86,6 +85,7 @@ html
8685
link(rel="stylesheet", href="assets/css/directives/badge-tooltip.css")
8786
link(rel="stylesheet", href="assets/css/community/statistics.css")
8887
link(rel="stylesheet", href="assets/css/community/members.css")
88+
link(rel="stylesheet", href="assets/css/community/community.css")
8989
link(rel="stylesheet", href="assets/css/account/reset-password.css")
9090
link(rel="stylesheet", href="assets/css/account/registered-successfully.css")
9191
link(rel="stylesheet", href="assets/css/account/register.css")
@@ -166,6 +166,7 @@ html
166166
script(src="account/account.module.js")
167167
script(src="account/account.routes.js")
168168
script(src="account/login/login.controller.js")
169+
script(src="account/logout/logout.controller.js")
169170
script(src="account/register/register.controller.js")
170171
script(src="account/reset-password/reset-password.controller.js")
171172
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/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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// filtering is a separate step to allow multiple pre-processings and filter out in single call
2525
subtrackRanks = UserStatsService.filterStats(subtrackRanks);
2626
// sort subtrack ranks
27-
subtrackRanks = $filter('orderBy')(subtrackRanks, 'mostRecentEventDate', true);
27+
subtrackRanks = $filter('orderBy')(subtrackRanks, 'mostRecentSubmissionDate', true);
2828

2929
vm.subtrackRanks = subtrackRanks;
3030
vm.hasRanks = !!vm.subtrackRanks.length;

app/profile/about/about.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@
6767
)
6868
.name {{subtrack.subTrack | track}}
6969

70-
.ranking(ng-if="subtrack.rating")
70+
.ranking(ng-if="subtrack.statType == 'Rating'")
7171
.number.rating(style="color: {{subtrack.rating | ratingColor}}")
7272
| {{subtrack.rating}}
7373

7474
.tag Rating
7575

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

7979
.tag Ranking

app/profile/profile.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// set profile to the object that was resolved
1414
vm.profile = profile;
1515
vm.userHandle = userHandle;
16+
vm.handleColor = ProfileService.getUserHandleColor(profile);
1617
vm.showBadges = showBadges;
1718
vm.closeDialog = closeDialog;
1819
vm.scrollTo = scrollTo;

app/profile/profile.controller.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ describe('Profile Controller', function() {
2424
getUserSkills: function() {
2525
return $q.when({result: {content: mockSkills}});
2626
},
27+
getUserHandleColor: function() {
28+
return 'something';
29+
},
2730
getRanks: ProfileService.getRanks
2831
};
2932
// mock user api
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.design(ng-if="vm.track == 'DESIGN'")
2+
3+
.bottom
4+
h2.detailed Details
5+
6+
ul.vertical-stats
7+
li.first
8+
.left Win Percentage
9+
.right {{vm.typeStats.winPercent | percentage | empty}}
10+
11+
li(ng-if="profileVm.isUser")
12+
.left Inquiries
13+
.right {{vm.typeStats.numInquiries | empty}}
14+
15+
li(ng-if="profileVm.isUser")
16+
.left Submissions
17+
.right {{vm.typeStats.submissions | empty}}
18+
19+
li
20+
.left Submission Rate
21+
.right {{vm.typeStats.submissionRate | percentage | empty}}
22+
23+
li.first(ng-if="profileVm.isUser")
24+
.left Passed Screening
25+
.right {{vm.typeStats.passedScreening | empty}}
26+
27+
li
28+
.left Screening Success Rate
29+
.right {{vm.typeStats.screeningSuccessRate | percentage | empty}}
30+
31+
li
32+
.left Average Placement
33+
.right {{vm.typeStats.avgPlacement | number: 2 | empty}}

app/profile/subtrack/nav.jade

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
.nav-top
2+
.user
3+
.avatar
4+
img(ng-src="{{vm.profile.photoURL}}")
5+
6+
.handle(style="color: {{vm.handleColor}}") {{vm.profile.handle}}
7+
8+
.exit(ng-click="vm.closeDialog()")
9+
img(src="/images/x-mark-gray.svg")
10+
11+
hr
112
.categoryNav
213
.track(
314
ng-repeat="track in vm.profile.tracks",

app/profile/subtrack/subtrack.controller.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727

2828
vm.pageName = vm.subTrack.toLowerCase().replace(/_/g, ' ');
2929

30-
vm.tabs = [];
31-
if (vm.track !== 'DESIGN') {
32-
vm.tabs.push('statistics');
33-
}
30+
vm.tabs = ['statistics'];
3431

3532
if (vm.track !== 'COPILOT') {
3633
vm.tabs.push( vm.subTrack === 'SRM' ? 'Past srm': 'challenges');
@@ -230,7 +227,7 @@
230227
template: 'profile/subtrack/nav.html',
231228
controller: 'ProfileCtrl',
232229
controllerAs: 'vm',
233-
className: 'ngdialog-theme-default',
230+
className: 'ngdialog-nav-theme',
234231
resolve: {
235232
userHandle: function() {
236233
return vm.userHandle;

app/profile/subtrack/subtrack.jade

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.profile-subtrack-container(ng-cloak, ng-show="profileVm.status.stats === 'ready'")
22
.content
33
.page-header
4-
page-state-header(handle="{{vm.userHandle}}", page-title="{{vm.pageName}}", hide-money="true", show-back-link="true", default-state="dashboard")
4+
page-state-header(handle="{{vm.userHandle}}", page-title="{{vm.pageName}}", hide-money="true", show-back-link="true", default-state="profile")
55
.nav-right
66
i.fa.fa-th(ng-click="vm.showNav()")
77
tc-tab-set
@@ -20,11 +20,10 @@
2020
p.label {{item.label}}
2121

2222
include ./develop/develop-statistics.jade
23-
//- yes, challenges :( this is confusing and needs refactoring
24-
include ./design/design-challenges.jade
23+
include ./design/design-statistics.jade
2524
include ./data/data-statistics.jade
2625

27-
tc-tab(heading="{{vm.tabs[1]}}", ng-if="vm.track === 'DATA_SCIENCE' || vm.track === 'DEVELOP'")
26+
tc-tab(heading="{{vm.tabs[1]}}")
2827
.subtrack-stats
2928
responsive-carousel(data="vm.subTrackStats", handle="{{vm.handle}}")
3029
.carousel-elem
@@ -37,5 +36,6 @@
3736
p.value(ng-hide="item.label === 'rating'") {{item.val | empty}}
3837

3938
p.label {{item.label}}
40-
include ./develop/develop-challenges.jade
39+
include ./develop/develop-challenges.jade
40+
include ./design/design-challenges.jade
4141
include ./data/data-challenges.jade

app/services/authToken.service.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe('TcAuthToken Service', function() {
5858
it('should remove tokens from store & cookie"', function() {
5959
service.removeTokens();
6060
expect($cookies.remove).to.have.been.calledWith('tcjwt');
61+
expect($cookies.remove).to.have.been.calledWith('tcsso');
6162
expect(store.remove).to.be.have.been.calledWith('appiriojwt');
6263
});
6364

0 commit comments

Comments
 (0)