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

Commit 82e5947

Browse files
author
Parth Shah
committed
Merge branch 'dev' into release/v1.0.8
Conflicts: config.js
2 parents a5a07ba + f9e3099 commit 82e5947

File tree

60 files changed

+1465
-1231
lines changed

Some content is hidden

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

60 files changed

+1465
-1231
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.challenge-links(ng-class="view + '-view'")
2+
a.registrants(ng-href="{{challenge|challengeLinks:'registrants'}}", ng-switch="challenge.subTrack")
3+
4+
.icon.registrants-icon
5+
p(ng-switch-when="MARATHON_MATCH") {{challenge.numRegistrants[0]}}
6+
p(ng-switch-default) {{challenge.numRegistrants}}
7+
8+
a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="")
9+
.icon.submissions-icon
10+
p {{challenge.numSubmissions}}
11+
12+
a.forum(ng-href="{{challenge|challengeLinks:'forums'}}")
13+
.icon.forum-icon
14+
p Posts
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(function() {
2+
'use strict';
3+
angular.module('tcUIComponents').directive('challengeLinks', function() {
4+
return {
5+
restrict: 'E',
6+
transclude: false,
7+
replace: true,
8+
templateUrl: 'directives/challenge-links/challenge-links.directive.html',
9+
scope: {
10+
challenge: '=',
11+
view: '='
12+
},
13+
controller: ['$log', '$scope', '$element', '$window',
14+
function($log, $scope, $element, $window) {
15+
16+
activate();
17+
18+
function activate() {
19+
//nothing to do as of now
20+
}
21+
}]
22+
};
23+
});
24+
})();

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

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,7 @@
88

99
p.subtrack-color {{challenge.subTrack | underscoreStrip}}
1010

11-
.challenge-links
12-
.stats
13-
a.registrants(ng-href="{{challenge|challengeLinks:'registrants'}}", ng-switch="challenge.subTrack")
14-
.registrants-icon
15-
16-
p(ng-switch-when="MARATHON_MATCH") {{challenge.numRegistrants[0]}}
17-
p(ng-switch-default) {{challenge.numRegistrants}}
18-
19-
a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="{{challenge|challengeLinks:'submissions'}}")
20-
.submissions-icon
21-
p {{challenge.numSubmissions}}
22-
23-
a.forum(ng-href="{{challenge|challengeLinks:'forums'}}")
24-
.forum-icon
25-
p Posts
11+
challenge-links(challenge="challenge", view="'tile'")
2612

2713
.challenge-details
2814
p.currentPhase {{challenge.userCurrentPhase}}
@@ -48,9 +34,13 @@
4834
.completed-challenge(
4935
ng-show="challenge.status === 'COMPLETED' || challenge.status === 'PAST'",
5036
ng-switch="challenge.track")
37+
.challenge-track
38+
5139
header
52-
53-
a(ng-href="{{challenge|challengeLinks:'detail'}}") {{challenge.name}}
40+
.top
41+
a.name(ng-href="{{challenge|challengeLinks:'detail'}}") {{challenge.name}}
42+
43+
p.subtrack-color {{challenge.subTrack | underscoreStrip}}
5444

5545
p.date-completed {{challenge.submissionEndDate | date : 'MMMM yyyy'}}
5646

@@ -70,16 +60,19 @@
7060
.challenge-details(ng-switch-when="DESIGN")
7161
design-challenge-user-place(challenge="challenge", view="view")
7262

63+
// Only show if not data science track
64+
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
65+
7366
.challenge.list-view(ng-show="view=='list'", ng-class="challenge.track")
7467
.active-challenge(ng-show="challenge.status === 'ACTIVE'")
7568
.challenge-track
7669

7770
header
78-
a(ng-href="{{challenge|challengeLinks:'detail'}}") {{challenge.name}}
71+
a.name(ng-href="{{challenge|challengeLinks:'detail'}}") {{challenge.name}}
7972

80-
p.subtrack {{challenge.subTrack | underscoreStrip}}
73+
p.subtrack-color {{challenge.subTrack | underscoreStrip}}
8174

82-
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:] {{challenge.userDetails.roles | listRoles}}
75+
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
8376

8477
.challenge-details
8578
.challenge-info
@@ -90,39 +83,26 @@
9083
p.ends-in(ng-hide="challenge.userCurrentPhaseEndTime") This challenge is currently paused.
9184

9285
.phase-action(ng-switch="challenge.userAction")
93-
a.tc-btn.tc-btn-s.tc-btn-wide.submit(ng-switch-when="Submit") Submit
86+
a.tc-btn.tc-btn-s.tc-btn-wide.tc-btn-ghost.submit(ng-switch-when="Submit") Submit
9487

9588
.submitted(ng-switch-when="Submitted") Submitted
9689

9790
// TODO: Need styling and JS logic for this one
9891
.registered(ng-switch-when="Registered") Registered
9992

100-
.challenge-links
101-
a.registrants(ng-href="{{challenge|challengeLinks:'registrants'}}", ng-switch="challenge.subTrack")
102-
103-
p(ng-switch-when="MARATHON_MATCH") {{challenge.numRegistrants[0]}}
104-
p(ng-switch-default) {{challenge.numRegistrants}}
105-
.registrants-icon
106-
107-
a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="")
108-
p {{challenge.numSubmissions}}
109-
.submissions-icon
110-
111-
a.forum(ng-href="{{challenge|challengeLinks:'forums'}}")
112-
.forum-icon
113-
p Posts
93+
challenge-links(challenge="challenge", view="'list'")
11494

11595
.completed-challenge(
11696
ng-show="challenge.status === 'COMPLETED' || challenge.status === 'PAST'",
11797
ng-switch="challenge.track")
11898
.challenge-track
11999

120100
header
121-
a(ng-href="{{challenge|challengeLinks:'detail'}}") {{challenge.name}}
101+
a.name(ng-href="{{challenge|challengeLinks:'detail'}}") {{challenge.name}}
122102

123-
p.subtrack {{challenge.subTrack | underscoreStrip}}
103+
p.subtrack-color {{challenge.subTrack | underscoreStrip}}
124104

125-
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:] {{challenge.userDetails.roles | listRoles}}
105+
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
126106

127107
.challenge-details(ng-switch-when="DATA_SCIENCE", ng-switch="challenge.subTrack", ng-class="challenge.track")
128108

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
scope: {
99
item: '='
1010
},
11-
controller: ['$scope', '$state', function($scope, $state) {
11+
controller: ['$scope', '$state', 'NavService', function($scope, $state, NavService) {
1212
var sref = $scope.item.sref;
1313
var href = $scope.item.href;
1414

@@ -17,11 +17,14 @@
1717
$scope.wtfhref = $state.href($scope.item.sref, $scope.item.srefParams);
1818

1919
$scope.isActive = function() {
20-
if (window.location.pathname == href || $state.is(sref))
20+
if (window.location.pathname == href || $state.is(sref)) {
21+
NavService.selectedTopLevelItem = NavService.hrefs[href] || NavService.hrefs[sref.slice(0, sref.indexOf('.'))];
22+
2123
return true;
24+
}
2225
return false;
2326
}
2427
}]
2528
};
2629
});
27-
})();
30+
})();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.page-state-header
2+
header
3+
.page-info
4+
h1 {{pageTitle}}
5+
div(ng-transclude)
6+
.info
7+
.pic
8+
a(ui-sref="profile.about({userHandle: vm.profile.handle})")
9+
img.profile-circle(ng-if="vm.profile.photoURL", ng-src="{{vm.profile.photoURL}}")
10+
img.profile-circle(ng-if="!vm.profile.photoURL", src="/images/ico-user-default.svg")
11+
.user-stats(id="metrics", ng-hide="vm.loading")
12+
.handle(style="color:{{vm.handleColor}};") {{vm.profile.handle}}
13+
.money-earned(ng-hide="hideMoney")
14+
p.number(ng-bind="vm.moneyEarned | currency:'$':0")
15+
p Earned
16+
.back-link(ng-if="showBackLink && vm.previousStateLabel")
17+
a(ui-sref="{{vm.previousStateName}}") Back to {{vm.previousStateLabel}}
18+
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
(function () {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('pageStateHeader', function() {
5+
return {
6+
restrict: 'E',
7+
templateUrl: 'directives/page-state-header/page-state-header.directive.html',
8+
transclude: true,
9+
scope: {
10+
handle: '@',
11+
pageTitle: '@',
12+
showBackLink: '=',
13+
hideMoney: '=',
14+
defaultState: '@'
15+
},
16+
controller: ['$scope', 'NotificationService', 'ProfileService', '$log', pageStateHeader],
17+
controllerAs: "vm"
18+
};
19+
});
20+
21+
function pageStateHeader($scope, NotificationService, ProfileService, $log) {
22+
var vm = this;
23+
vm.handle = $scope.handle;
24+
vm.profile = null;
25+
vm.handleColor = null;
26+
vm.hideMoney = _.get($scope, 'hideMoney', true);
27+
vm.previousStateName = null;
28+
vm.previousStateLabel = null;
29+
vm.previousState = null;
30+
vm.showBackLink = _.get($scope, 'showBackLink', false);
31+
32+
activate();
33+
34+
function activate() {
35+
vm.loading = true;
36+
37+
// identifies the previous state
38+
if ($scope.$root.previousState && $scope.$root.previousState.name.length > 0) {
39+
console.log($scope.$root.previousState);
40+
vm.previousState = $scope.$root.previousState;
41+
vm.previousStateName = vm.previousState.name;
42+
} else if ($scope.defaultState) {
43+
vm.previousStateName = $scope.defaultState;
44+
}
45+
46+
// sets the label of the link based on the state
47+
if (vm.previousStateName) {
48+
if (vm.previousStateName === 'dashboard') {
49+
vm.previousStateLabel = 'Dashboard';
50+
} else if (vm.previousStateName === 'profile') {
51+
vm.previousStateLabel = 'Profile';
52+
}
53+
}
54+
55+
// gets member's profile
56+
ProfileService.getUserProfile(vm.handle).then(function(profile) {
57+
vm.profile = profile;
58+
vm.handleColor = ProfileService.getUserHandleColor(vm.profile);
59+
if (!vm.hideMoney) {
60+
displayMoneyEarned(vm.handle);
61+
} else {
62+
vm.loading = false;
63+
}
64+
});
65+
}
66+
67+
function displayMoneyEarned(handle) {
68+
ProfileService.getUserFinancials(handle)
69+
.then(function(financials) {
70+
vm.moneyEarned = _.sum(_.pluck(financials, 'amount'));
71+
72+
if (!vm.moneyEarned) {
73+
vm.hideMoney = true;
74+
}
75+
76+
vm.loading = false;
77+
})
78+
.catch(function(err) {
79+
vm.hideMoney = true;
80+
vm.loading = false;
81+
});
82+
}
83+
}
84+
})();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.tab-panel
2+
3+
ul.tab-set
4+
li.tab-pill(ng-repeat="tab in tabSet.tabs")
5+
a(ng-click="tabSet.select(tab)")
6+
.header(ng-class="{'selected': tab.active}") {{tab.heading}}
7+
8+
.tab-view(ng-transclude)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
(function() {
2+
'use strict';
3+
angular.module('tcUIComponents')
4+
.directive('tcTabSet', function() {
5+
return {
6+
restrict: 'E',
7+
transclude: true,
8+
bindToController: true,
9+
templateUrl: 'directives/tc-tabs/tc-tabs.directive.html',
10+
scope: {},
11+
controller: ['$log', function($log, $scope, $element) {
12+
$log = $log.getInstance('TcTabSetController');
13+
var self = this;
14+
self.tabs = [];
15+
self.addTab = function addTab(tab) {
16+
self.tabs.push(tab);
17+
if (self.tabs.length === 1) {
18+
tab.active = true;
19+
}
20+
};
21+
22+
self.select = function(selectedTab) {
23+
angular.forEach(self.tabs, function(tab) {
24+
if (tab.active && tab !== selectedTab) {
25+
tab.active = false;
26+
}
27+
})
28+
29+
selectedTab.active = true;
30+
}
31+
}],
32+
controllerAs: "tabSet"
33+
};
34+
})
35+
.directive('tcTab', function() {
36+
return {
37+
restrict: 'E',
38+
transclude: true,
39+
template: '<div ng-show="active", ng-transclude></div>',
40+
require: '^tcTabSet',
41+
scope: {
42+
heading: '@'
43+
},
44+
link: function(scope, elem, attr, tabSetCtrl) {
45+
scope.active = false;
46+
tabSetCtrl.addTab(scope);
47+
}
48+
}
49+
});
50+
})();

app/directives/tc-tabs/tc-tabs.directive.spec.js

Whitespace-only changes.

app/index.jade

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ html
5959
link(rel="stylesheet", href="assets/css/directives/track-toggle.css")
6060
link(rel="stylesheet", href="assets/css/directives/toggle-password-with-tips.css")
6161
link(rel="stylesheet", href="assets/css/directives/toggle-password.css")
62+
link(rel="stylesheet", href="assets/css/directives/tc-tabs.css")
6263
link(rel="stylesheet", href="assets/css/directives/tc-section.css")
6364
link(rel="stylesheet", href="assets/css/directives/tc-paginator.css")
6465
link(rel="stylesheet", href="assets/css/directives/tc-endless-paginator.css")
6566
link(rel="stylesheet", href="assets/css/directives/srm-tile.css")
6667
link(rel="stylesheet", href="assets/css/directives/skill-tile.css")
6768
link(rel="stylesheet", href="assets/css/directives/responsive-carousel.css")
6869
link(rel="stylesheet", href="assets/css/directives/profile-widget.css")
70+
link(rel="stylesheet", href="assets/css/directives/page-state-header.directive.css")
6971
link(rel="stylesheet", href="assets/css/directives/ios-card.css")
7072
link(rel="stylesheet", href="assets/css/directives/input-sticky-placeholder.css")
7173
link(rel="stylesheet", href="assets/css/directives/history-graph.css")
@@ -76,6 +78,7 @@ html
7678
link(rel="stylesheet", href="assets/css/directives/design-lightbox.css")
7779
link(rel="stylesheet", href="assets/css/directives/design-challenge-user-place.css")
7880
link(rel="stylesheet", href="assets/css/directives/challenge-tile.css")
81+
link(rel="stylesheet", href="assets/css/directives/challenge-links.directive.css")
7982
link(rel="stylesheet", href="assets/css/directives/badge-tooltip.css")
8083
link(rel="stylesheet", href="assets/css/account/reset-password.css")
8184
link(rel="stylesheet", href="assets/css/account/registered-successfully.css")
@@ -170,6 +173,7 @@ html
170173
script(src="directives/account/validate-register.directive.js")
171174
script(src="directives/badges/badge-tooltip.directive.js")
172175
script(src="directives/busy-button/busy-button.directive.js")
176+
script(src="directives/challenge-links/challenge-links.directive.js")
173177
script(src="directives/challenge-tile/challenge-tile.directive.js")
174178
script(src="directives/challenge-user-place/challenge-user-place.directive.js")
175179
script(src="directives/distribution-graph/distribution-graph.directive.js")
@@ -180,6 +184,7 @@ html
180184
script(src="directives/input-sticky-placeholder/input-sticky-placeholder.directive.js")
181185
script(src="directives/ios-card/ios-card.directive.js")
182186
script(src="directives/on-file-change.directive.js")
187+
script(src="directives/page-state-header/page-state-header.directive.js")
183188
script(src="directives/profile-widget/profile-widget.directive.js")
184189
script(src="directives/responsive-carousel/responsive-carousel.directive.js")
185190
script(src="directives/skill-tile/skill-tile.directive.js")
@@ -188,6 +193,7 @@ html
188193
script(src="directives/tc-endless-paginator/tc-endless-paginator.directive.js")
189194
script(src="directives/tc-paginator/tc-paginator.directive.js")
190195
script(src="directives/tc-section/tc-section.directive.js")
196+
script(src="directives/tc-tabs/tc-tabs.directive.js")
191197
script(src="directives/tc-transclude.directive.js")
192198
script(src="directives/track-toggle/track-toggle.directive.js")
193199
script(src="topcoder.module.js")
@@ -251,6 +257,7 @@ html
251257
script(src="services/introduction.service.js")
252258
script(src="services/jwtInterceptor.service.js")
253259
script(src="services/memberCert.service.js")
260+
script(src="services/nav.service.js")
254261
script(src="services/notification.service.js")
255262
script(src="services/profile.service.js")
256263
script(src="services/review.service.js")

0 commit comments

Comments
 (0)