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

Commit 71e1ec8

Browse files
author
vikasrohit
committed
Merge branch 'dev' into release/v1.0.8
* dev: (21 commits) first round of changes fixing test fixing settings style settings header changes cleanup fixed mistake Changed background color of page state header to $gray-lightest from $white Fixed background colors of my challenges and my arms remove skill fix SUP-2234, Dashboard-->Same challenge should not be displayed twice on ios dashboard. fixed Change text for endless pagination from More to Load More final fixes sticky fixed thanks to @Vikas! cleanup made nav logic more complete fixed skill grid for desktop Profile fixes, buttons, and small refactors a couple cursor fixes Scalable layout on Profile, have to replace the plugin to affix the user component, as Angular ngSticky is really bugy. ...
2 parents 6a7a199 + a8b8d01 commit 71e1ec8

Some content is hidden

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

46 files changed

+684
-340
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
.registered(ng-switch-when="Registered") Registered
3030

3131
// Only show if not data science track
32-
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
32+
p.roles
33+
span(ng-hide="challenge.track === 'DATA_SCIENCE'")
34+
#[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
3335

3436
.completed-challenge(
3537
ng-show="challenge.status === 'COMPLETED' || challenge.status === 'PAST'",

app/directives/external-account/external-account.directive.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.ext-tile(ng-repeat="account in accountList | orderBy:'order'", ng-click="!account.disabled && !readOnly && handleClick(account.provider, account.status)", ng-class="{'connected': account.status === 'linked', 'connecting': account.status === 'pending', 'disabled': account.disabled, 'enabled': !account.disabled, 'read-only': readOnly}")
1+
.ext-tile(ng-repeat="account in accountList | orderBy:'order'", ng-click="!account.disabled && !readOnly && handleClick(account.provider, account.status)", ng-class="{'connected': account.status === 'linked', 'connecting': account.status === 'pending', 'disabled': account.disabled, 'enabled': !account.disabled, 'read-only': readOnly, 'connect': account.status === 'unlinked' && !account.disabled}")
22
.external-account-box(ng-class="account.colorClass")
33
i.fa(ng-class="account.className")
44

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
$scope.isActive = function() {
2020
if (window.location.pathname == href || $state.is(sref)) {
21-
NavService.selectedTopLevelItem = NavService.hrefs[href] || NavService.hrefs[sref.slice(0, sref.indexOf('.'))];
21+
NavService.selectedTopLevelItem = NavService.getParent(href || sref);
22+
//NavService.hrefs[href] || NavService.hrefs[sref.slice(0, sref.indexOf('.'))];
2223

2324
return true;
2425
}

app/directives/page-state-header/page-state-header.directive.jade

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
.info
77
.pic
88
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")
9+
img.profile-circle(ng-src="{{vm.profile.photoURL}}", loading-src="/images/ico-user-default.svg")
1110
.user-stats(id="metrics", ng-hide="vm.loading")
1211
.handle(style="color:{{vm.handleColor}};") {{vm.profile.handle}}
1312
.money-earned(ng-hide="hideMoney")
1413
p.number(ng-bind="vm.moneyEarned | currency:'$':0")
1514
p Earned
1615
.back-link(ng-if="showBackLink && vm.previousStateLabel")
17-
a(ui-sref="{{vm.previousStateName}}") Back to {{vm.previousStateLabel}}
16+
a(ng-click="vm.backHandler()") Back to {{vm.previousStateLabel}}
1817

app/directives/page-state-header/page-state-header.directive.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
hideMoney: '=',
1414
defaultState: '@'
1515
},
16-
controller: ['$scope', 'NotificationService', 'ProfileService', '$log', pageStateHeader],
16+
controller: ['$scope', 'NotificationService', 'ProfileService', '$log', '$state', pageStateHeader],
1717
controllerAs: "vm"
1818
};
1919
});
2020

21-
function pageStateHeader($scope, NotificationService, ProfileService, $log) {
21+
function pageStateHeader($scope, NotificationService, ProfileService, $log, $state) {
2222
var vm = this;
2323
vm.handle = $scope.handle;
2424
vm.profile = null;
@@ -28,7 +28,7 @@
2828
vm.previousStateLabel = null;
2929
vm.previousState = null;
3030
vm.showBackLink = _.get($scope, 'showBackLink', false);
31-
31+
vm.backHandler = backHandler;
3232
activate();
3333

3434
function activate() {
@@ -47,7 +47,7 @@
4747
if (vm.previousStateName) {
4848
if (vm.previousStateName === 'dashboard') {
4949
vm.previousStateLabel = 'Dashboard';
50-
} else if (vm.previousStateName === 'profile') {
50+
} else if (vm.previousStateName.indexOf('profile') > -1) {
5151
vm.previousStateLabel = 'Profile';
5252
}
5353
}
@@ -64,6 +64,21 @@
6464
});
6565
}
6666

67+
function backHandler() {
68+
var _params = {};
69+
var _name = vm.previousStateName;
70+
switch (vm.previousStateName) {
71+
case 'profile.about':
72+
_params = {userHandle: vm.profile.handle};
73+
break;
74+
case 'dashboard':
75+
default:
76+
_name = 'dashboard';
77+
break;
78+
}
79+
$state.go(_name, _params);
80+
}
81+
6782
function displayMoneyEarned(handle) {
6883
ProfileService.getUserFinancials(handle)
6984
.then(function(financials) {

app/directives/profile-widget/profile-widget.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
h3.tenure(ng-if="profile.startMonth")
1414
| Member Since {{profile.startMonth}}
1515

16-
a.tc-btn.tc-btn-m.edit(ng-show="editProfileLink", ui-sref="settings.profile") Edit Profile
16+
a.tc-btn.tc-btn-s.edit(ng-show="editProfileLink", ui-sref="settings.profile") Edit Profile
1717

18-
.tracks-links
18+
.tracks-links(ng-if="profile.tracks && profile.tracks.length > 0")
1919
.tracks
2020
.track(ng-repeat="track in (profile.tracks)", ng-click="profileVm.scrollTo(track)")
2121
div(class="track-icon {{profileVm.imgMap[track]}}-icon")
2222
div
2323
.text {{track | role}}
2424

25-
p.description {{profile.description}}
25+
p.description(ng-if="profile.description") {{profile.description}}
2626

2727
.links
2828
a.badges.link(ng-click="profileVm.showBadges()", ng-show="profileVm.profile.badges.Achievements.length > 0")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
a(ng-click="enableHide && toggle()", ng-class="{'hidden': skill.hidden, 'new': skill.isNew}")
1+
a(ng-click="enableHide && toggle()", ng-class="{'skill-hidden': skill.hidden, 'new': skill.isNew}")
22
.skill-icon(ng-switch="skill.category")
33
.remove-indicator
44

@@ -10,4 +10,4 @@ a(ng-click="enableHide && toggle()", ng-class="{'hidden': skill.hidden, 'new': s
1010

1111
img(ng-switch-when="DATA_SCIENCE", ng-src="{{ASSET_PREFIX}}images/skills/id-{{skill.tagId}}.svg", fallback-src="/images/skills/id-data.svg")
1212

13-
.name {{skill.tagName}}
13+
.name {{skill.tagName | characters: 20:false}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
div.paginator
22
tc-section(state="state")
3-
button.tc-btn(ng-show="pageParams.totalCount > pageParams.currentCount", ng-click="loadMore()") More
3+
button.tc-btn(ng-show="pageParams.totalCount > pageParams.currentCount", ng-click="loadMore()") Load More
44

app/directives/tc-sticky/tc-sticky.directive.jade

Whitespace-only changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
(function() {
3+
'use strict';
4+
5+
angular.module('tcUIComponents').directive('tcSticky', ['CONSTANTS', '$window', tcSticky]);
6+
7+
function tcSticky(CONSTANTS, $window) {
8+
return {
9+
restrict: 'A',
10+
link: function(scope, element) {
11+
scope.width = element.prop('offsetWidth');
12+
var elWidth = scope.width + 'px',
13+
elChild = angular.element(element[0].querySelector(':first-child'));
14+
// elChild.css('width', elWidth);
15+
angular.element($window).bind("scroll", function() {
16+
var affixElement = document.getElementById('affix'),
17+
xPosition = 0,
18+
yPosition = 0;
19+
function getPosition(element) {
20+
while(element) {
21+
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
22+
element = element.offsetParent;
23+
}
24+
}
25+
getPosition(affixElement);
26+
var height = angular.element(affixElement).prop('offsetHeight');
27+
var top = angular.element(affixElement).prop('offsetTop');
28+
// console.log(yPosition);
29+
// console.log(angular.element(document).scrollTop);
30+
// console.log(elChild[0].clientTop);
31+
if (yPosition >= 0 || $window.innerHeight <= elChild[0].offsetHeight || $window.innerWidth < 768) {
32+
elChild.removeClass('affix affix-bottom');
33+
} else if ( yPosition < 0) {
34+
console.log(top + height);
35+
console.log(yPosition);
36+
console.log(top + height + yPosition);
37+
if (top + height + yPosition < 800) {
38+
elChild.addClass('affix-bottom');
39+
elChild.removeClass('affix');
40+
} else {
41+
elChild.removeClass('affix-bottom');
42+
elChild.addClass('affix');
43+
}
44+
45+
};
46+
});
47+
}
48+
};
49+
}
50+
})();

app/filters/truncate.filter.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('topcoder')
5+
.filter('characters', function () {
6+
return function (input, chars, breakOnWord) {
7+
if (isNaN(chars)) return input;
8+
if (chars <= 0) return '';
9+
if (input && input.length > chars) {
10+
input = input.substring(0, chars);
11+
12+
if (!breakOnWord) {
13+
var lastspace = input.lastIndexOf(' ');
14+
//get last space
15+
if (lastspace !== -1) {
16+
input = input.substr(0, lastspace);
17+
}
18+
}else{
19+
while(input.charAt(input.length-1) === ' '){
20+
input = input.substr(0, input.length -1);
21+
}
22+
}
23+
return input + '…';
24+
}
25+
return input;
26+
};
27+
})
28+
.filter('splitcharacters', function() {
29+
return function (input, chars) {
30+
if (isNaN(chars)) return input;
31+
if (chars <= 0) return '';
32+
if (input && input.length > chars) {
33+
var prefix = input.substring(0, chars/2);
34+
var postfix = input.substring(input.length-chars/2, input.length);
35+
return prefix + '...' + postfix;
36+
}
37+
return input;
38+
};
39+
})
40+
.filter('words', function () {
41+
return function (input, words) {
42+
if (isNaN(words)) return input;
43+
if (words <= 0) return '';
44+
if (input) {
45+
var inputWords = input.split(/\s+/);
46+
if (inputWords.length > words) {
47+
input = inputWords.slice(0, words).join(' ') + '…';
48+
}
49+
}
50+
return input;
51+
};
52+
});
53+
})();

app/index.jade

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ html
6060
link(rel="stylesheet", href="assets/css/directives/toggle-password-with-tips.css")
6161
link(rel="stylesheet", href="assets/css/directives/toggle-password.css")
6262
link(rel="stylesheet", href="assets/css/directives/tc-tabs.css")
63+
link(rel="stylesheet", href="assets/css/directives/tc-sticky.css")
6364
link(rel="stylesheet", href="assets/css/directives/tc-section.css")
6465
link(rel="stylesheet", href="assets/css/directives/tc-paginator.css")
6566
link(rel="stylesheet", href="assets/css/directives/tc-endless-paginator.css")
@@ -145,6 +146,8 @@ html
145146
script(src='../bower_components/restangular/dist/restangular.js')
146147
script(src='../bower_components/angular-touch/angular-touch.js')
147148
script(src='../bower_components/angular-carousel/dist/angular-carousel.js')
149+
script(src='../bower_components/matchmedia/matchMedia.js')
150+
script(src='../bower_components/ngSticky/lib/sticky.js')
148151
//- endbower
149152
//- inject:nonBowerScripts
150153
script(src="/scripts/auth0-angular.js")
@@ -193,6 +196,7 @@ html
193196
script(src="directives/tc-endless-paginator/tc-endless-paginator.directive.js")
194197
script(src="directives/tc-paginator/tc-paginator.directive.js")
195198
script(src="directives/tc-section/tc-section.directive.js")
199+
script(src="directives/tc-sticky/tc-sticky.directive.js")
196200
script(src="directives/tc-tabs/tc-tabs.directive.js")
197201
script(src="directives/tc-transclude.directive.js")
198202
script(src="directives/track-toggle/track-toggle.directive.js")
@@ -212,6 +216,7 @@ html
212216
script(src="filters/role.filter.js")
213217
script(src="filters/time-diff.filter.js")
214218
script(src="filters/track.filter.js")
219+
script(src="filters/truncate.filter.js")
215220
script(src="filters/underscore-strip.filter.js")
216221
script(src="layout/layout.module.js")
217222
script(src="layout/header/header.controller.js")

app/layout/header/header.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
}
7373

7474
function selectedGroup() {
75-
return _.get(NavService, 'selectedTopLevelItem.parent', null);
75+
return _.get(NavService, 'selectedTopLevelItem', null);
7676
}
7777
}
7878
})();

app/layout/header/header.jade

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
li.menu-item.link-group.user-menu(ng-switch="vm.isAuth", ng-class="{'anonymous-menu': !vm.isAuth}")
3030
// links for logged in user
3131
div(ng-switch-when="true")
32-
.menu-item-header
32+
.menu-item-header(
33+
ng-class="{'hide': vm.selectedGroup() == 'user'}"
34+
)
3335
span(ui-sref="profile.about({userHandle: vm.userHandle})")
34-
img(class="user-avatar", ng-src="{{vm.profile.photoURL}}")
36+
img(class="user-avatar", ng-src="{{vm.profile.photoURL}}", loading-src="/images/ico-user-default.svg")
3537

3638
span.username(
3739
style="color:{{vm.userHandleColor}}",
38-
ng-class="{'underline': vm.selectedGroup()}"
40+
ng-class="{'underline': vm.selectedGroup() == 'user'}"
3941
) {{vm.userHandle}}
4042

4143
a.btn-link.btn-edit-profile.show-small(ui-sref="settings.profile") EDIT
@@ -56,7 +58,10 @@
5658

5759
//- a(ng-click="launchIntro();", ng-show="!!vm.introOptions") Intro
5860
59-
li.menu-item.link-group(ng-repeat="(menu, items) in vm.menuLinks")
61+
li.menu-item.link-group(
62+
ng-repeat="(menu, items) in vm.menuLinks",
63+
ng-class="{'selected': vm.selectedGroup() == menu}"
64+
)
6065
.menu-item-header {{menu}}
6166

6267
ul.submenu

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
ChallengeService.processActiveDevDesignChallenges(devDesignChallenges);
5151
ChallengeService.processActiveMarathonMatches(marathonMatches);
5252
var userChallenges = marathonMatches.concat(devDesignChallenges);
53-
// FIX when working on marathon matches:
54-
// sort by closest deadline? .sort(function)
55-
// limit to 8 .slice(0, 8);
5653

57-
vm.myChallenges = userChallenges;
54+
userChallenges = _.sortBy(userChallenges, function(n) {
55+
return n.registrationEndDate
56+
});
57+
vm.myChallenges = userChallenges.reverse().slice(0, 8);
5858
vm.userHasChallenges = true;
5959
vm.loading = false;
6060
}

app/my-dashboard/programs/programs.controller.js

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,16 @@
5555
}
5656

5757
function loadChallenges() {
58-
var challengePromises = [
59-
ChallengeService.getChallenges({
60-
filter: "reviewType=peer&status=active",
61-
limit: 3,
62-
offset: 0,
63-
orderBy: 'submissionEndDate'
64-
}),
65-
ChallengeService.getChallenges({
66-
filter: "platforms=ios&technologies=swift&status=active",
67-
limit: 3,
68-
offset: 0,
69-
orderBy: 'submissionEndDate'
70-
})
71-
];
72-
73-
return $q.all(challengePromises)
74-
.then(function(challenges) {
75-
var peerChallenges = challenges[0];
76-
var iOSChallenges = challenges[1];
77-
var challenges = [];
78-
79-
if (peerChallenges.length === 0) {
80-
challenges = challenges.concat(iOSChallenges);
81-
} else if (peerChallenges.length > 0) {
82-
challenges = challenges.concat(peerChallenges[0]).concat(iOSChallenges.slice(0, iOSChallenges.length - 1));
58+
ChallengeService.getChallenges({
59+
filter: "platforms=ios&technologies=swift&status=active",
60+
limit: 3,
61+
offset: 0,
62+
orderBy: 'submissionEndDate desc'
63+
}).then(function(challenges) {
64+
if (challenges.length > 0) {
65+
vm.challenges = challenges.slice(0, 3);
66+
ChallengeService.processActiveDevDesignChallenges(vm.challenges);
8367
}
84-
85-
vm.challenges = challenges;
86-
ChallengeService.processActiveDevDesignChallenges(vm.challenges);
8768
vm.loading = false;
8869
})
8970
.catch(function(err) {

app/profile/about/about.jade

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
.about-container
2-
.profile-header-container(ng-cloak)
3-
profile-widget(profile="profileVm.profile", edit-profile-link="profileVm.showEditProfileLink", num-wins="profileVm.numWins", profile-vm="profileVm")
2+
3+
.profile-header-container(ng-cloak,id="affix", tc-sticky)
4+
//- .sticky-container(sticky media-query="min-width: 780px" use-placeholder="true" offset="10" confine="true" sticky-class="sticked")
5+
profile-widget(profile="profileVm.profile", edit-profile-link="profileVm.showEditProfileLink", num-wins="profileVm.numWins", profile-vm="profileVm")
46
7+
//- .sticky-container(bs-affix data-offset-top="10" data-offset-bottom="400")
8+
.sticky-container()
9+
profile-widget(profile="profileVm.profile", edit-profile-link="profileVm.showEditProfileLink", num-wins="profileVm.numWins", profile-vm="profileVm")
10+
11+
512
.profile-about-container
613

714
#skills

0 commit comments

Comments
 (0)