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

Commit b43e990

Browse files
author
vikasrohit
committed
Merge branch 'dev' into feature/empty-state-directive
* dev: (41 commits) SUP-2241, Dashboard--> "This challenge is currently paused" should have padding on challenge card. #60 Styling "Login" and "Register" buttons in logged out state 6 or so more fixes Nav: Blue arrow for active nav item is not aligned fixed hover for skills on profile a fix for image upload styling fixing stackoverlow integration fixing image checkbox label size, removed extra images navigation fixed, new icons, new track icons Fixed mobile layout issue with challenges section another potential input fix SUP-2241, Dashboard--> "This challenge is currently paused" should have padding on challenge card. Fixed Sticky directive using v3 user endpoint SUP-2143, Dashboard--> Texts are overlapping on my challenges on mobile device. input test changes round 2 first round of changes fixing test ... Conflicts: app/my-dashboard/my-challenges/my-challenges.controller.js
2 parents de74b8f + 3a9add8 commit b43e990

File tree

124 files changed

+16284
-917
lines changed

Some content is hidden

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

124 files changed

+16284
-917
lines changed

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

Lines changed: 6 additions & 2 deletions
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'",
@@ -61,7 +63,9 @@
6163
design-challenge-user-place(challenge="challenge", view="view")
6264

6365
// Only show if not data science track
64-
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
66+
p.roles
67+
span(ng-hide="challenge.track === 'DATA_SCIENCE'")
68+
#[span Role:  ] #[span {{challenge.userDetails.roles | listRoles}}]
6569

6670
.challenge.list-view(ng-show="view=='list'", ng-class="challenge.track")
6771
.active-challenge(ng-show="challenge.status === 'ACTIVE'")

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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
header
33
.page-info
44
h1 {{pageTitle}}
5+
div(ng-transclude)
56
.info
67
.pic
78
a(ui-sref="profile.about({userHandle: vm.profile.handle})")
89
img.profile-circle(ng-if="vm.profile.photoURL", ng-src="{{vm.profile.photoURL}}")
910
img.profile-circle(ng-if="!vm.profile.photoURL", src="/images/ico-user-default.svg")
11+
1012
.user-stats(id="metrics", ng-hide="vm.loading")
1113
.handle(style="color:{{vm.handleColor}};") {{vm.profile.handle}}
1214
.money-earned(ng-hide="hideMoney")
1315
p.number(ng-bind="vm.moneyEarned | currency:'$':0")
1416
p Earned
1517
.back-link(ng-if="showBackLink && vm.previousStateLabel")
16-
a(ui-sref="{{vm.previousStateName}}") Back to {{vm.previousStateLabel}}
18+
a(ng-click="vm.backHandler()") Back to {{vm.previousStateLabel}}
1719

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
return {
66
restrict: 'E',
77
templateUrl: 'directives/page-state-header/page-state-header.directive.html',
8+
transclude: true,
89
scope: {
910
handle: '@',
1011
pageTitle: '@',
1112
showBackLink: '=',
1213
hideMoney: '=',
1314
defaultState: '@'
1415
},
15-
controller: ['$scope', 'NotificationService', 'ProfileService', '$log', pageStateHeader],
16+
controller: ['$scope', 'NotificationService', 'ProfileService', '$log', '$state', pageStateHeader],
1617
controllerAs: "vm"
1718
};
1819
});
1920

20-
function pageStateHeader($scope, NotificationService, ProfileService, $log) {
21+
function pageStateHeader($scope, NotificationService, ProfileService, $log, $state) {
2122
var vm = this;
2223
vm.handle = $scope.handle;
2324
vm.profile = null;
@@ -27,7 +28,7 @@
2728
vm.previousStateLabel = null;
2829
vm.previousState = null;
2930
vm.showBackLink = _.get($scope, 'showBackLink', false);
30-
31+
vm.backHandler = backHandler;
3132
activate();
3233

3334
function activate() {
@@ -46,7 +47,7 @@
4647
if (vm.previousStateName) {
4748
if (vm.previousStateName === 'dashboard') {
4849
vm.previousStateLabel = 'Dashboard';
49-
} else if (vm.previousStateName === 'profile') {
50+
} else if (vm.previousStateName.indexOf('profile') > -1) {
5051
vm.previousStateLabel = 'Profile';
5152
}
5253
}
@@ -63,6 +64,21 @@
6364
});
6465
}
6566

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+
6682
function displayMoneyEarned(handle) {
6783
ProfileService.getUserFinancials(handle)
6884
.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: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
var hitBottom = false;
16+
angular.element($window).bind("scroll", function() {
17+
var affixElement = document.getElementById('affix'),
18+
xPosition = 0,
19+
yPosition = 0;
20+
function getPosition(element) {
21+
while(element) {
22+
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
23+
element = element.offsetParent;
24+
}
25+
}
26+
getPosition(affixElement);
27+
var height = angular.element(affixElement).prop('offsetHeight');
28+
var top = angular.element(affixElement).prop('offsetTop');
29+
// console.log(yPosition);
30+
// console.log(angular.element(document).scrollTop);
31+
// console.log(elChild[0].clientTop);
32+
if (yPosition >= 0 || $window.innerHeight <= elChild[0].offsetHeight || $window.innerWidth < 768) {
33+
elChild.removeClass('affix affix-bottom');
34+
} else if ( yPosition < 0) {
35+
var bodyRect = document.body.getBoundingClientRect()
36+
var elChildRect = elChild[0].getBoundingClientRect()
37+
var elChildAbsOffset = elChildRect.top - bodyRect.top;
38+
39+
var affixElementRect = affixElement.getBoundingClientRect();
40+
var affixElementAbsOffset = affixElementRect.top - bodyRect.top;
41+
42+
var elChildOffset = elChildAbsOffset - affixElementAbsOffset;
43+
var elChildHeight = elChild[0].clientHeight;
44+
var affixElementHeight = affixElement.clientHeight;
45+
46+
console.log(elChildRect.top);
47+
48+
var pastBottom = elChildOffset + elChildHeight > affixElementHeight;
49+
var topCovered = elChildRect.top > 10;
50+
51+
console.log('topcovered', topCovered);
52+
console.log('pastBottom', pastBottom);
53+
54+
elChild.addClass('affix');
55+
56+
if (pastBottom && !hitBottom) {
57+
hitBottom = true;
58+
elChild.addClass('affix-bottom');
59+
elChild.removeClass('affix');
60+
}
61+
62+
if (topCovered) {
63+
hitBottom = false;
64+
elChild.removeClass('affix-bottom');
65+
elChild.addClass('affix');
66+
}
67+
}
68+
});
69+
}
70+
};
71+
}
72+
})();

app/directives/track-toggle/track-toggle.directive.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
span.onoffswitch-inner
2525
span.onoffswitch-switch
2626

27-
hr
27+
hr.bottom

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")
@@ -146,6 +147,8 @@ html
146147
script(src='../bower_components/restangular/dist/restangular.js')
147148
script(src='../bower_components/angular-touch/angular-touch.js')
148149
script(src='../bower_components/angular-carousel/dist/angular-carousel.js')
150+
script(src='../bower_components/matchmedia/matchMedia.js')
151+
script(src='../bower_components/ngSticky/lib/sticky.js')
149152
//- endbower
150153
//- inject:nonBowerScripts
151154
script(src="/scripts/auth0-angular.js")
@@ -195,6 +198,7 @@ html
195198
script(src="directives/tc-endless-paginator/tc-endless-paginator.directive.js")
196199
script(src="directives/tc-paginator/tc-paginator.directive.js")
197200
script(src="directives/tc-section/tc-section.directive.js")
201+
script(src="directives/tc-sticky/tc-sticky.directive.js")
198202
script(src="directives/tc-tabs/tc-tabs.directive.js")
199203
script(src="directives/tc-transclude.directive.js")
200204
script(src="directives/track-toggle/track-toggle.directive.js")
@@ -214,6 +218,7 @@ html
214218
script(src="filters/role.filter.js")
215219
script(src="filters/time-diff.filter.js")
216220
script(src="filters/track.filter.js")
221+
script(src="filters/truncate.filter.js")
217222
script(src="filters/underscore-strip.filter.js")
218223
script(src="layout/layout.module.js")
219224
script(src="layout/header/header.controller.js")

app/layout/header/header.controller.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747

4848
vm.userMenu = [
4949
{ 'sref': 'dashboard', 'text': 'DASHBOARD', 'icon': '/images/nav/dashboard.svg' },
50-
{ 'sref': 'profile.about', 'srefParams': { 'userHandle': vm.userHandle }, 'text': 'MY PROFILE', 'icon': '/images/nav/badge.svg' },
51-
{ 'href': vm.constants.COMMUNITY_URL + '/PactsMemberServlet?module=PaymentHistory&full_list=false', 'text': 'PAYMENTS', 'icon': '/images/nav/money-bag.svg', 'target': '_blank' },
52-
{ 'sref': 'settings.profile', 'text': 'SETTINGS', 'icon': '/images/nav/gear.svg' },
50+
{ 'sref': 'profile.about', 'srefParams': { 'userHandle': vm.userHandle }, 'text': 'MY PROFILE', 'icon': '/images/nav/profile.svg' },
51+
{ 'href': vm.constants.COMMUNITY_URL + '/PactsMemberServlet?module=PaymentHistory&full_list=false', 'text': 'PAYMENTS', 'icon': '/images/nav/wallet.svg', 'target': '_blank' },
52+
{ 'sref': 'settings.profile', 'text': 'SETTINGS', 'icon': '/images/nav/settings.svg' },
5353
];
5454

5555
ProfileService.getUserProfile(vm.userHandle)
@@ -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
})();

0 commit comments

Comments
 (0)