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 9141bd2

Browse files
committedJul 30, 2015
Merge pull request #58 from appirio-tech/rank-empty-state
Show empty state if user has no ratings
2 parents 0ac2fda + 8d0cd05 commit 9141bd2

File tree

7 files changed

+63
-44
lines changed

7 files changed

+63
-44
lines changed
 

‎app/my-dashboard/header-dashboard/header-dashboard.controller.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
var vm = this;
1414
vm.domain = CONSTANTS.domain;
1515
vm.defaultPhotoUrl = "/images/avatarPlaceholder.png";
16-
vm.isCopilot = true;
16+
vm.isCopilot = false;
1717
vm.loading = true;
18+
vm.hasRatings = true;
1819

1920
activate();
2021

@@ -26,15 +27,24 @@
2627
vm.profile = profile;
2728
});
2829

29-
ProfileService.getUserStats(username).then(function(stats) {
30+
ProfileService.getUserStats(username)
31+
.then(function(stats) {
3032
vm.rankStats = ProfileService.getRanks(stats);
33+
34+
if (vm.rankStats.length === 0) {
35+
vm.hasRatings = false;
36+
}
37+
3138
vm.loading = false;
32-
}).catch(function(err) {
39+
})
40+
.catch(function(err) {
41+
vm.hasRatings = false;
3342
vm.loading = false;
3443
// todo handle error
3544
})
3645

37-
ProfileService.getUserFinancials(username).then(function(financials) {
46+
ProfileService.getUserFinancials(username)
47+
.then(function(financials) {
3848
vm.moneyEarned = financials.overallEarning;
3949
});
4050

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ header
88
//- a(ng-href="http://community.{{vm.domain}}/tc?module=MyHome") Edit Profile
99
1010
profile-widget(profile="vm.profile", edit-profile-link="true")
11-
11+
1212
.user-stats
1313
.money-earned
1414
p(ng-bind='vm.moneyEarned || 0 | currency:undefined:0')
@@ -22,13 +22,16 @@ header
2222

2323
hr
2424

25-
.section-loading(ng-show="vm.loading")
25+
.loading(ng-show="vm.loading")
26+
.section-loading
27+
28+
hr
2629

27-
.ratings(ng-hide="vm.loading")
30+
.ratings(ng-if="vm.hasRatings && !vm.loading")
2831
.track(ng-repeat="r in vm.rankStats")
2932
p(ng-bind="r.rank")
3033

3134
p {{r.track}}:
3235
p {{r.subTrack}}
3336

34-
hr
37+
hr

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,30 @@
1111
vm.loading = true;
1212
vm.myChallenges = [];
1313

14+
// Can we remove these since the filter is going on a different page?
1415
vm.viewActiveChallenges = viewActiveChallenges;
1516
vm.viewPastChallenges = viewPastChallenges;
1617

17-
var activate = function() {
18+
var userId = UserService.getUserIdentity().userId;
19+
20+
activate();
21+
22+
function activate() {
1823
viewActiveChallenges();
1924
}
2025

21-
var userId = UserService.getUserIdentity().userId;
26+
function viewActiveChallenges() {
27+
vm.myChallenges = [];
28+
getChallenges('Active', 'submissionEndDate asc');
29+
};
30+
31+
function viewPastChallenges() {
32+
vm.myChallenges = [];
33+
getChallenges('Completed', 'submissionEndDate asc');
34+
};
2235

2336
// get ACTIVE challenges and spotlight challenges
24-
var getChallenges = function(status, orderBy) {
37+
function getChallenges(status, orderBy) {
2538
vm.loading = true;
2639
var challengeOptions = {
2740
limit: 6,
@@ -57,18 +70,6 @@
5770
});
5871
}
5972

60-
function viewActiveChallenges() {
61-
vm.myChallenges = [];
62-
getChallenges('Active', 'submissionEndDate asc');
63-
};
64-
65-
function viewPastChallenges() {
66-
vm.myChallenges = [];
67-
getChallenges('Completed', 'submissionEndDate asc');
68-
};
69-
70-
activate();
71-
7273
function processChallengesResponse(data) {
7374
angular.forEach(data, function(challenge) {
7475
var now = moment();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ header
99
section.challenges(ng-hide="vm.loading")
1010
challenge-tile.tile(ng-repeat="challenge in vm.myChallenges", challenge="challenge", domain="vm.domain")
1111

12-
challenge-tile.tile.spotlight(challenge="vm.spotlightChallenge", domain="vm.domain", spotlight)
12+
challenge-tile.tile.spotlight(spotlight, challenge="vm.spotlightChallenge", domain="vm.domain")
1313

1414
.section-links
1515
.new-challenges.link

‎assets/css/directives/challenge-tiles.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import '../partials/combined';
22

3+
// Default Challenge Tile Stylings
34
.tile {
45
background-color: $medium-gray;
56
box-sizing: border-box;
@@ -99,3 +100,22 @@
99100
}
100101
}
101102
}
103+
104+
// Stylings for Spotlight Challenges
105+
.spotlight {
106+
width: 48%;
107+
108+
.placeholder {
109+
font-size: 22px;
110+
color: $dark-gray;
111+
text-align: center;
112+
margin-top: 30px;
113+
}
114+
115+
.challenge-status {
116+
display: flex;
117+
flex-direction: row;
118+
justify-content: space-between;
119+
padding-top: 50px;
120+
}
121+
}

‎assets/css/member-dashboard/header-dashboard.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,19 @@
7070
}
7171
}
7272

73+
.loading {
74+
margin-top: -20px;
75+
}
76+
7377
.ratings {
7478
display: flex;
7579
flex-flow: row wrap;
7680
justify-content: center;
77-
margin-bottom: 27px;
7881
font-size: 13px;
7982

8083
.track {
8184
width: 120px;
85+
margin-bottom: 20px;
8286
text-align: center;
8387

8488
p:first-child {

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,5 @@ $url_10: url(../images/sort-arrows.png);
3434
/* The negative margin here removes the leftmost tiles'
3535
margin, since we can't use .tile:first-child here */
3636
margin-left: -20px;
37-
38-
.spotlight {
39-
width: 48%;
40-
41-
.placeholder {
42-
font-size: 22px;
43-
color: $dark-gray;
44-
text-align: center;
45-
margin-top: 15px;
46-
margin-bottom: 15px;
47-
}
48-
49-
.challenge-status {
50-
display: flex;
51-
flex-direction: row;
52-
justify-content: space-between;
53-
padding-top: 50px;
54-
}
55-
}
5637
}
5738
}

0 commit comments

Comments
 (0)
This repository has been archived.