Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4438c09

Browse files
author
vikasrohit
committedSep 29, 2015
Merge pull request #237 from appirio-tech/feature/vikas-sup-1595-my-challenges
Feature/vikas sup 1595 my challenges @parthshah Merging to get latest for working on SUP-1638 (My SRMs)
2 parents d4254a9 + fd8395a commit 4438c09

File tree

7 files changed

+268
-114
lines changed

7 files changed

+268
-114
lines changed
 
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/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

‎app/my-challenges/my-challenges.routes.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
function routes($stateProvider, $urlRouterProvider, $httpProvider) {
1212
var states = {
1313
'my-challenges': {
14-
url: '/my-challenges/',
14+
url: '/my-challenges/:status',
1515
parent: 'root',
1616
templateUrl: 'my-challenges/my-challenges.html',
1717
controller: 'MyChallengesController',
@@ -23,7 +23,10 @@
2323
resolve: {
2424
userIdentity: ['UserService', function(UserService) {
2525
return UserService.getUserIdentity();
26-
}]
26+
}],
27+
statusFilter: ['$stateParams', function($stateParams) {
28+
return $stateParams.status;
29+
}],
2730
}
2831
}
2932
};

‎app/my-dashboard/my-challenges/my-challenges.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ section.hasChallenges(ng-if="vm.userHasChallenges && !vm.loading", ng-class="{ '
4545
challenge-tile(ng-repeat="challenge in vm.myChallenges | orderBy:registrationEndDate:true", challenge="challenge", view="vm.challengeView", ng-class="vm.challengeView + '-view'")
4646

4747
.my-challenges-links(ng-if="vm.userHasChallenges && !vm.loading")
48-
a(ui-sref="my-challenges") View All Active Challenges
48+
a(ui-sref="my-challenges({status: 'active'})") View All Active Challenges
4949

50-
a(ui-sref="my-challenges") View All Past Challenges
50+
a(ui-sref="my-challenges({status: 'completed'})") View All Past Challenges

‎assets/css/directives/tc-paginator.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.tc-paginator {
55
display: flex;
66
flex-flow: row wrap;
7-
justify-content: flex-end;
7+
justify-content: space-between;
88
margin-right: 10px;
99
margin-bottom: 10px;
1010

@@ -16,5 +16,12 @@
1616
color: $dark-gray;
1717
cursor: default;
1818
}
19+
20+
&.prev {
21+
text-transform: uppercase;
22+
}
23+
&.next {
24+
text-transform: uppercase;
25+
}
1926
}
2027
}

‎assets/css/my-challenges/my-challenges.scss

Lines changed: 210 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -29,95 +29,243 @@
2929
display: flex;
3030
flex-direction: column;
3131

32-
header {
33-
position: relative;
34-
margin-bottom: 35px;
35-
36-
p.noChallenges {
37-
text-align: center;
38-
margin-top: 10px;
39-
font-size: 18px;
32+
.nav {
33+
@include module-full-width;
34+
background: white;
35+
height: 100px;
36+
padding-left: 60px;
37+
padding-right: 60px;
38+
display: flex;
39+
flex-direction: row;
40+
justify-content: space-between;
41+
align-items: center;
42+
margin-bottom: 8px;
43+
.arrow {
44+
width: 15px;
4045
}
46+
.breadcrumbs {
47+
font-family: 'Sofia Pro';
48+
font-weight: 200;
49+
font-size: 14px;
50+
line-height: 16px;
51+
.dashboard {
52+
display: block;
53+
color: black;
54+
text-align: center;
55+
text-transform: uppercase;
4156

42-
p.viewChallenges {
43-
position: absolute;
44-
top: 3px;
45-
right: 10px;
46-
47-
a {
48-
text-decoration: underline;
57+
a {
58+
text-decoration: none;
59+
}
60+
}
61+
.my-challenges {
62+
display: block;
63+
color: $accent-color;
64+
font-weight: 700;
65+
text-align: center;
66+
text-transform: uppercase;
4967
}
5068
}
69+
}
5170

52-
p.viewDashboard {
53-
position: absolute;
54-
top: 3px;
55-
left: 10px;
71+
section.noChallenges {
72+
text-align: center;
73+
margin-top: 10px;
74+
font-size: 18px;
75+
}
5676

57-
a {
58-
text-decoration: underline;
59-
}
60-
}
77+
.content {
78+
margin-left: 10px;
79+
margin-right: 10px;
80+
section.challenges {
81+
background: white;
82+
align-self: center;
83+
margin-top: 15px;
84+
padding-bottom: 15px;
85+
padding-top: 10px 20px 0px 20px;
86+
display: flex;
87+
flex-flow: column wrap;
88+
position: relative;
89+
width: 100%;
6190

62-
p.viewOptions {
63-
position: absolute;
64-
top: 3px;
65-
right: 150px;
91+
.top {
92+
/*position: relative;*/
93+
display: flex;
94+
flex-direction: row;
95+
justify-content: space-between;
96+
padding-top: 35px;
97+
padding-bottom: 35px;
98+
border-bottom: 1px solid #F0F0F0;
6699

67-
a {
68-
text-decoration: underline;
100+
.filters {
101+
position: initial;
102+
/*bottom: 0;
103+
left: 55px;*/
104+
margin-left: 55px;
105+
align-self: flex-start;
106+
text-transform: uppercase;
107+
a {
108+
text-decoration: none;
69109

70-
&.disabled {
71-
text-decoration: none;
72-
color: $dark-gray;
73-
cursor: default;
110+
&.disabled {
111+
color: $dark-gray;
112+
cursor: default;
113+
}
114+
}
115+
}
116+
117+
.challenge-view-toggle {
118+
position: initial;
119+
/*bottom: 0;
120+
right: 55px;*/
121+
margin-right: 55px;
122+
align-self: flex-end;
123+
button {
124+
margin-right: 17px;
125+
padding: 0;
126+
border: 0;
127+
outline: 0;
128+
background-color: $white;
129+
@include sofia-pro-light;
130+
font-size: 11px;
131+
line-height: 16px;
132+
text-transform: uppercase;
133+
color: $black;
134+
135+
&.disabled {
136+
color: #A3A3AE;
137+
}
138+
139+
&:before {
140+
content: '';
141+
display: inline-block;
142+
margin-bottom: 2px;
143+
margin-right: 4px;
144+
vertical-align: middle;
145+
@include background-image-size(16px, 16px);
146+
}
147+
148+
&.tile:before {
149+
background: url(/images/ico-grid.svg);
150+
}
151+
&.list:before {
152+
background: url(/images/ico-list.svg);
153+
}
154+
155+
}
74156
}
75157
}
76-
}
77158

78-
p.filters {
79-
position: absolute;
80-
top: 3px;
81-
right: 10px;
159+
.data {
160+
display: flex;
161+
flex-flow: row wrap;
162+
padding: 15px 0px;
163+
margin-left: 55px;
82164

83-
a {
84-
text-decoration: underline;
165+
&.list-view {
166+
flex-flow: column wrap;
167+
}
168+
}
85169

86-
&.disabled {
87-
text-decoration: none;
88-
color: $dark-gray;
89-
cursor: default;
170+
.bottom {
171+
border-top: 1px solid #F0F0F0;
172+
padding: 35px 55px 15px 55px;
173+
}
174+
175+
challenge-tile {
176+
&.tile-view {
177+
margin-bottom: 20px;
178+
@media only screen and (max-width: 767px) {
179+
display: inline-block;
180+
margin-left: 15px;
181+
182+
&:first-child {
183+
margin-left: 0;
184+
}
185+
}
186+
@media only screen and (min-width: 768px) {
187+
&:nth-child(2n + 1) {
188+
margin-right: 15px;
189+
}
190+
}
191+
@media only screen and (min-width: 870px) {
192+
margin-right: 15px;
193+
194+
&:nth-child(3n) {
195+
margin-right: 0;
196+
}
197+
}
198+
@media only screen and (min-width: 1155px) {
199+
&:nth-child(3n) {
200+
margin-right: 15px;
201+
}
202+
&:nth-child(4n) {
203+
margin-right: 0;
204+
}
205+
}
206+
}
207+
&.list-view {
208+
width: 100%;
90209
}
91210
}
92211
}
93212
}
213+
}
214+
}
94215

95-
section.challenges {
96-
display: flex;
97-
flex-flow: column wrap;
98-
position: relative;
99-
/* The negative margin here removes the leftmost tiles'
100-
margin, since we can't use .tile:first-child here */
101-
margin-left: -20px;
102216

103-
.data {
217+
@media (min-width: 768px) {
218+
.my-challenges-container {
219+
.my-challenges {
220+
.nav {
104221
display: flex;
105-
flex-flow: row wrap;
222+
flex-direction: row;
223+
justify-content: space-between;
224+
margin-bottom: 8px;
106225

107-
&.list-view {
108-
flex-flow: column wrap;
226+
.breadcrumbs {
227+
font-size: 28px;
228+
line-height: 34px;
229+
display: flex;
230+
flex-direction: row;
231+
.dashboard {
232+
display: block;
233+
color: black;
234+
text-align: center;
235+
text-transform: uppercase;
236+
}
237+
.my-challenges {
238+
display: block;
239+
color: $accent-color;
240+
font-weight: 700;
241+
text-align: center;
242+
text-transform: uppercase;
243+
}
109244
}
110245
}
246+
}
247+
}
248+
}
111249

112-
challenge-tile {
113-
&.tile-view {
114-
margin-left: 20px;
115-
margin-bottom: 20px;
116-
}
117-
&.list-view {
118-
width: 100%;
250+
@media (min-width: 870px) {
251+
.my-challenges-container {
252+
.my-challenges {
253+
section.challenges {
254+
.data {
255+
max-width: 840px;
119256
}
120257
}
121258
}
122259
}
123260
}
261+
@media (min-width: 1155px) {
262+
.my-challenges-container {
263+
.my-challenges {
264+
section.challenges {
265+
.data {
266+
max-width: 1125px;
267+
}
268+
}
269+
}
270+
}
271+
}

0 commit comments

Comments
 (0)
This repository has been archived.