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

Commit ccdcf3a

Browse files
author
Parth Shah
committed
Merge branch 'dev' of github.com:appirio-tech/topcoder-app into dev
2 parents 0f63023 + 381600a commit ccdcf3a

Some content is hidden

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

43 files changed

+899
-494
lines changed

app/account/account.routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
'login': {
3131
parent: 'auth',
32-
url: '/login/?next&code&state&status&userJWTToken',
32+
url: '/login/?next&code&state&status&userJWTToken&utm_source&utm_medium&utm_campaign',
3333
params: { 'notifyReset': false },
3434
data: {
3535
title: 'Login'
@@ -51,7 +51,7 @@
5151
},
5252
'register': {
5353
parent: 'auth',
54-
url: '/register/?next',
54+
url: '/register/?next&utm_source&utm_medium&utm_campaign',
5555
data: {
5656
title: "Join"
5757
},

app/account/login/login.controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
function(data) {
2323
// success
2424
$log.debug('logged in');
25+
// setup login event for analytics tracking
26+
Helpers.setupLoginEventMetrices(usernameOrEmail);
2527
return Helpers.redirectPostLogin($stateParams.next);
2628
})
2729
.catch(function(resp) {

app/account/register/register.controller.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
$log = $log.getInstance("RegisterController");
1010
$log.debug("-init");
1111
var vm = this;
12+
// prepares utm params, if available
13+
var utm = {
14+
source : $stateParams && $stateParams.utm_source ? $stateParams.utm_source : '',
15+
medium : $stateParams && $stateParams.utm_medium ? $stateParams.utm_medium : '',
16+
campaign : $stateParams && $stateParams.utm_campaign ? $stateParams.utm_campaign : ''
17+
};
1218

1319

1420
// Set default for toggle password directive
@@ -40,9 +46,9 @@
4046
country: {
4147
code: vm.country
4248
},
43-
utmSource: '',
44-
utmMedium: '',
45-
utmCampaign: ''
49+
utmSource: utm.source,
50+
utmMedium: utm.medium,
51+
utmCampaign: utm.campaign
4652
};
4753

4854
if (!vm.isSocialRegistration) {

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

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,65 @@
11
.challenge.tile-view(ng-show="view === 'tile'", ng-class="challenge.track")
2-
.challenge-track
2+
.active-challenge(ng-show="challenge.status === 'ACTIVE'")
3+
.challenge-track
34

4-
header
5-
a(ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}") {{challenge.name}}
5+
header
6+
a(ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}") {{challenge.name}}
67

7-
p {{challenge.subTrack | underscoreStrip}}
8+
p.subtrack-color {{challenge.subTrack | underscoreStrip}}
89

9-
.challenge-details
10-
p.currentPhase {{challenge.userCurrentPhase}}
10+
.challenge-details
11+
p.currentPhase {{challenge.userCurrentPhase}}
1112

12-
.challenge-calendar(ng-show="challenge.userCurrentPhaseEndTime")
13-
p.ends-in Ends In
14-
p.time-remaining {{challenge.userCurrentPhaseEndTime[0]}}
15-
p.unit-of-time {{challenge.userCurrentPhaseEndTime[1]}}
13+
.challenge-calendar(ng-show="challenge.userCurrentPhaseEndTime")
14+
p.ends-in Ends In
15+
p.time-remaining {{challenge.userCurrentPhaseEndTime[0]}}
16+
p.unit-of-time {{challenge.userCurrentPhaseEndTime[1]}}
1617

17-
.stalled-challenge(ng-hide="challenge.userCurrentPhaseEndTime") This challenge is currently paused.
18+
.stalled-challenge(ng-hide="challenge.userCurrentPhaseEndTime") This challenge is currently paused.
1819

19-
.phase-action(ng-switch="challenge.userAction")
20-
.submit(ng-switch-when="Submit") Submit
20+
.phase-action(ng-switch="challenge.userAction")
21+
.submit(ng-switch-when="Submit") Submit
2122

22-
.submitted(ng-switch-when="Submitted") Submitted
23+
.submitted(ng-switch-when="Submitted") Submitted
2324

24-
// Need styling and JS logic for this one
25-
.registered(ng-switch-when="Registered") Registered
25+
// Need styling and JS logic for this one
26+
.registered(ng-switch-when="Registered") Registered
27+
28+
// Only show if not data science track
29+
p.roles {{challenge.userDetails.roles | listRoles}}
30+
31+
.challenge-links
32+
.stats
33+
a.registrants(ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}#viewRegistrant")
34+
.registrants-icon
35+
36+
p {{challenge.numRegistrants}}
37+
38+
a.submissions(ng-hide="challenge.track === 'DATA SCIENCE'", ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}#viewRegistrant")
39+
.submissions-icon
40+
41+
p {{challenge.numSubmissions}}
42+
43+
a.forum(ng-href="http://apps.{{DOMAIN}}/forums//?module=Category&categoryID={{challenge.forumId}}")
44+
.forum-icon
2645

27-
// Only show if not data science track
28-
p.roles {{challenge.userDetails.roles | listRoles}}
46+
p Forum
2947

30-
.challenge-links
31-
.stats
32-
a.registrants(ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}#viewRegistrant")
33-
.registrants-icon
48+
.completed-challenge(ng-show="challenge.status === 'COMPLETED'")
49+
header
50+
a(ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}") {{challenge.name}}
3451

35-
p {{challenge.numRegistrants}}
52+
p.date-completed {{challenge.submissionEndDate | date : 'MMMM yyyy'}}
3653

37-
a.submissions(ng-hide="challenge.track === 'DATA SCIENCE'", ng-href="https://www.{{DOMAIN}}/challenge-details/{{challenge.id}}/?type={{challenge.track}}#viewRegistrant")
38-
.submissions-icon
54+
.winner-ribbon(ng-show="challenge.wonFirst")
3955

40-
p {{challenge.numSubmissions}}
56+
.challenge-details
57+
p.place(ng-class="{ 'first-place': challenge.wonFirst }") {{challenge.highestPlacement}}#[span {{challenge.highestPlacement | ordinal:true}}] Place
4158

42-
a.forum(ng-href="http://apps.{{DOMAIN}}/forums//?module=Category&categoryID={{challenge.forumId}}")
43-
.forum-icon
59+
.challenge-score
60+
p.score {{challenge.userDetails.submissionReviewScore/100 | percentage}}
4461

45-
p Forum
62+
p Review Score
4663

4764
.challenge.list-view(ng-show="view=='list'", ng-class="challenge.track")
4865
.challenge-track
@@ -52,7 +69,6 @@
5269

5370
p.subtrack {{challenge.subTrack | underscoreStrip}}
5471

55-
// Only show if not data science track
5672
p.roles(ng-hide="challenge.track === 'DATA SCIENCE'") #[span Role:] {{challenge.userDetails.roles | listRoles}}
5773

5874
.challenge-details
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
p.pager
2-
a.prev(ng-click="vm.prevPage()", ng-class="{disabled: !vm.prevPageAvailable}") Prev
3-
span   |  
4-
span.first(ng-bind="vm.pageParams.offset + 1")
5-
span -
6-
span.last(ng-bind="vm.pageParams.offset + vm.pageParams.count")
7-
span   of  
8-
span.total(ng-bind="vm.pageParams.totalCount")
9-
span   |  
1+
.pager
2+
a.prev(ng-click="vm.prevPage()", ng-class="{disabled: !vm.prevPageAvailable}") Previous
3+
.status
4+
span Showing  
5+
span.first(ng-bind="vm.pageParams.offset + 1")
6+
span -
7+
span.last(ng-bind="vm.pageParams.offset + vm.pageParams.count")
8+
span   of  
9+
span.total(ng-bind="vm.pageParams.totalCount")
1010
a.next(ng-click="vm.nextPage()", ng-class="{disabled: !vm.nextPageAvailable}") Next

app/filters/ordinal.filter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
angular.module('topcoder').filter('ordinal', ordinal);
55

66
function ordinal() {
7-
return function(x) {
7+
return function(x, onlySuffix) {
88
x += '';
99
var y = x.charAt(x.length - 1);
1010
var suffix;
@@ -21,6 +21,11 @@
2121
default:
2222
suffix = 'th';
2323
}
24+
25+
if (onlySuffix) {
26+
return suffix;
27+
}
28+
2429
return x + suffix;
2530
};
2631
}

app/filters/rating-color.filter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414
var colors = [
1515
// grey
1616
{
17-
'color': '#7f7f7f',
17+
'color': '#9D9FA0',
1818
'darkerColor': '#656565',
1919
'start': 0,
2020
'end': 899
2121
},
2222
// green
2323
{
24-
'color': '#99cc09',
24+
'color': '#69C329',
2525
'darkerColor': '#7aa307',
2626
'start': 900,
2727
'end': 1199
2828
},
2929
// blue
3030
{
31-
'color': '#09affe',
31+
'color': '#616BD5',
3232
'darkerColor': '#078ccb',
3333
'start': 1200,
3434
'end': 1499
3535
},
3636
// yellow
3737
{
38-
'color': '#f39426',
38+
'color': '#FCB816',
3939
'darkerColor': '#c2761e',
4040
'start': 1500,
4141
'end': 2199
4242
},
4343
// red
4444
{
45-
'color': '#fe0866',
45+
'color': '#EF3A3A',
4646
'darkerColor': '#cb0651',
4747
'start': 2200,
4848
'end': Infinity

app/index.jade

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ html
8383

8484
toaster-container(toaster-options="{{main.globalToasterConfig}}")
8585

86-
.view-container(ui-view="container")
86+
.fold-wrapper
87+
.view-container(ui-view="container")
88+
.fold-pusher
8789

8890
div(ui-view="footer")
8991

@@ -241,6 +243,27 @@ html
241243
// endinject
242244
// endbuild
243245
246+
// tracking code for Marketo
247+
script(type='text/javascript').
248+
document.write(unescape("%3Cscript src='//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E"));
249+
script.
250+
Munchkin.init('921-UOU-112', {"wsInfo":"jFRS"}
251+
);
252+
// tracking code for Kissmetrics
253+
script(type='text/javascript').
254+
var _kmq = _kmq || [];
255+
var _kmk = _kmk || 'aa23cd43c455ef33b6a0df3de81a79af9ea30f75';
256+
function _kms(u){
257+
setTimeout(function(){
258+
var d = document, f = d.getElementsByTagName('script')[0],
259+
s = d.createElement('script');
260+
s.type = 'text/javascript'; s.async = true; s.src = u;
261+
f.parentNode.insertBefore(s, f);
262+
}, 1);
263+
}
264+
_kms('//i.kissmetrics.com/i.js');
265+
_kms('//scripts.kissmetrics.com/' + _kmk + '.2.js');
266+
244267
script(type="text/javascript").
245268
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
246269
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

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

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

44
angular.module('tc.myChallenges').controller('MyChallengesController', MyChallengesController);
55

6-
MyChallengesController.$inject = ['ChallengeService', 'UserService', '$q', '$log', 'CONSTANTS', 'Helpers', '$scope', 'userIdentity'];
6+
MyChallengesController.$inject = ['ChallengeService', 'UserService', '$q', '$log', 'CONSTANTS', 'Helpers', '$scope', 'userIdentity', 'statusFilter'];
77

8-
function MyChallengesController(ChallengeService, UserService, $q, $log, CONSTANTS, Helpers, $scope, userIdentity) {
8+
function MyChallengesController(ChallengeService, UserService, $q, $log, CONSTANTS, Helpers, $scope, userIdentity, statusFilter) {
99
var vm = this;
1010
vm.domain = CONSTANTS.domain;
1111
vm.loading = true;
@@ -15,7 +15,8 @@
1515
vm.viewPastChallenges = viewPastChallenges;
1616
vm.view = 'list';
1717
vm.changeView = changeView;
18-
vm.statusFilter = 'active';
18+
vm.statusFilter = statusFilter ? statusFilter : 'active';
19+
1920
// paging params, these are updated by tc-pager
2021
vm.pageParams = {
2122
offset : 0,
@@ -27,8 +28,8 @@
2728
};
2829
vm.orderBy = 'submissionEndDate';
2930

30-
var userId = UserService.getUserIdentity().userId;
31-
var handle = UserService.getUserIdentity().handle;
31+
var userId = userIdentity.userId;
32+
var handle = userIdentity.handle;
3233

3334
activate();
3435

@@ -39,7 +40,11 @@
3940
$scope.$watch('vm.pageParams.updated', function(updatedParams) {
4041
_getChallenges();
4142
});
42-
viewActiveChallenges();
43+
if (vm.statusFilter == 'completed') {
44+
viewPastChallenges();
45+
} else {
46+
viewActiveChallenges();
47+
}
4348
}
4449

4550
function changeView(view) {
@@ -70,9 +75,7 @@
7075
limit: vm.pageParams.limit,
7176
offset: vm.pageParams.offset,
7277
orderBy: vm.orderBy, // TODO verify if this is the correct sort order clause,
73-
filter: {
74-
status : vm.statusFilter
75-
}
78+
filter: "status=" + vm.statusFilter
7679
};
7780
vm.loading = true;
7881
return ChallengeService.getUserChallenges(handle, params)

app/my-challenges/my-challenges.jade

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,35 @@
11
.my-challenges-container
22
.my-challenges
3-
header
4-
h1.section-title My Challenges
53

6-
p.viewDashboard
7-
a(ui-sref="dashboard") View Dashboard
8-
9-
p.noChallenges(ng-hide="vm.userHasChallenges") You have not participated in any challenges yet.
10-
11-
p.viewOptions
12-
a(ng-click="vm.changeView('list')", ng-class="{disabled: vm.view == 'list'}") List
13-
14-
span   |  
15-
16-
a(ng-click="vm.changeView('tile')", ng-class="{disabled: vm.view == 'tile'}") Tile
17-
18-
p.filters
19-
a(ng-click="vm.viewActiveChallenges()", ng-class="{disabled: vm.statusFilter == 'active'}") Active
20-
span   |  
21-
a(ng-click="vm.viewPastChallenges()", ng-class="{disabled: vm.statusFilter == 'completed'}") Past
4+
.nav
5+
.breadcrumbs
6+
.dashboard
7+
a(ui-sref="dashboard") Dashboard
8+
.my-challenges // My Challenges
229

2310
.section-loading(ng-show="vm.loading")
2411

25-
section.challenges(ng-show="vm.userHasChallenges && !vm.loading")
26-
tc-paginator(data="vm.myChallenges", page-params="vm.pageParams")
12+
section.noChallenges(ng-if="!vm.userHasChallenges && !vm.loading")
13+
You have not participated in any challenges yet.
14+
15+
.content
16+
section.challenges(ng-show="vm.userHasChallenges && !vm.loading")
17+
.top
18+
.filters
19+
a(ng-click="vm.viewActiveChallenges()", ng-class="{disabled: vm.statusFilter == 'active'}") Active
20+
span   |  
21+
a(ng-click="vm.viewPastChallenges()", ng-class="{disabled: vm.statusFilter == 'completed'}") Past
2722

28-
.data(ng-class="vm.view + '-view'")
29-
challenge-tile(ng-repeat="challenge in vm.myChallenges | orderBy:registrationEndDate:true", challenge="challenge", view="vm.view", ng-class="vm.view + '-view'")
23+
.challenge-view-toggle
24+
button.tile(ng-click="vm.changeView('tile')", ng-class="{ disabled: vm.view === 'tile' }") Grid
3025

31-
.section-links
32-
.link
33-
a(href="https://www.{{vm.domain}}/challenges/?pageIndex=1") Find New Challenges
26+
button.list(ng-click="vm.changeView('list')", ng-class="{ disabled: vm.view === 'list' }") List
3427

35-
.link(ng-show="vm.isCopilot")
36-
a(href="https://www.{{vm.domain}}/direct") Launch Topcoder Direct
28+
.data(ng-class="vm.view + '-view'")
29+
challenge-tile(ng-repeat="challenge in vm.myChallenges | orderBy:registrationEndDate:true", challenge="challenge", view="vm.view", ng-class="vm.view + '-view'")
3730

38-
.link(ng-hide="vm.userHasChallenges")
39-
a(href="https://community.{{vm.domain}}/", target="_blank") View Help Library
31+
.bottom
32+
tc-paginator(data="vm.myChallenges", page-params="vm.pageParams")
4033

4134
hr
4235

0 commit comments

Comments
 (0)