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

Commit 6f5c701

Browse files
author
Parth Shah
committed
Merge branch 'dev' of github.com:appirio-tech/topcoder-app into dev
2 parents e8a9bce + 1caa6e4 commit 6f5c701

22 files changed

+484
-240
lines changed

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/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")
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/index.jade

Lines changed: 4 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")

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: 8 additions & 3 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})")
3436
img(class="user-avatar", ng-src="{{vm.profile.photoURL}}")
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/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

app/services/nav.service.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
angular.module('tc.services').factory('NavService', NavService);
55

6-
NavService.$inject = ['CONSTANTS'];
6+
NavService.$inject = ['CONSTANTS', '$state', 'UserService', 'TcAuthService'];
77

8-
function NavService(CONSTANTS) {
8+
function NavService(CONSTANTS, $state, UserService, TcAuthService) {
99

1010
var service = {
1111

12-
selectedTopLevelItem: null
12+
selectedTopLevelItem: null,
13+
getParent: getParent
1314

1415
};
1516

@@ -40,6 +41,7 @@
4041
{'href': 'profile'},
4142
{'href': 'settings'},
4243
{'href': 'my-dashboard'},
44+
{'href': 'dashboard'},
4345
{'href': 'my-challenges'}
4446
];
4547

@@ -64,6 +66,20 @@
6466
service.hrefs[link.href] = link;
6567
});
6668

69+
function getParent(ref) {
70+
if (ref.indexOf(-1) >= 0)
71+
ref = ref.slice(0, ref.indexOf('.'));
72+
if (ref.match(/profile/)) {
73+
if (TcAuthService.isAuthenticated() && $state.params && $state.params.userHandle == UserService.getUserIdentity().handle) {
74+
return 'user';
75+
} else {
76+
return 'community';
77+
}
78+
} else {
79+
return service.hrefs[ref] && service.hrefs[ref].parent;
80+
}
81+
}
82+
6783

6884
return service;
6985

app/topcoder.module.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
'toaster',
3131
'angular-intro',
3232
'ngMessages',
33-
'angular-carousel'
33+
'angular-carousel',
34+
'sticky'
3435
];
3536

3637
angular.module('topcoder', dependencies).run(appRun);

assets/css/directives/external-link-data.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,24 @@ external-accounts {
122122

123123
}
124124
}
125+
125126
@media (min-width: 768px) {
126127
.external-link-list {
127128
display: flex;
128129
flex-direction: row;
129130
flex-wrap: wrap;
130131
justify-content: flex-start;
131-
padding: 0px 75px;
132+
padding: 0px 60px;
132133

133134
.external-link-tile {
134135
border: 1px solid #f0f0f0;
135136
background-color: $gray-lightest;
136-
margin-left: 30px;
137+
margin-left: 15px;
137138
margin-top: 30px;
138139
margin-bottom: 0px;
139-
&:nth-child(3n+1) {
140-
margin-left: 0px;
141-
}
140+
// &:nth-child(3n+1) {
141+
// margin-left: 0px;
142+
// }
142143
width: 218px;
143144
height: 240px;
144145
display: flex;
@@ -209,6 +210,7 @@ external-accounts {
209210

210211
}
211212
}
213+
212214
.logo {
213215
padding: 10px;
214216
font-size: 50px;

assets/css/directives/profile-widget.scss

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
margin-top: 5px;
2323
font-size: 12px;
2424
line-height: 14px;
25-
@include sofia-pro-medium;
25+
@include sofia-pro-light;
2626
color: $accent-gray;
2727
text-align: center;
2828
text-transform: uppercase;
@@ -86,17 +86,19 @@
8686
flex-direction: column;
8787
align-items: center;
8888
margin-top: 40px;
89+
width: 100%;
90+
8991

9092
.tracks {
9193
display: flex;
9294
flex-direction: row;
9395
justify-content: center;
94-
overflow-x: auto;
95-
overflow-y: hidden;
96+
9697
.track {
9798
cursor: pointer;
9899
display: flex;
99100
width: 100%;
101+
flex-wrap: wrap;
100102
flex-direction: column;
101103
align-items: center;
102104
+ .track {
@@ -107,13 +109,14 @@
107109
width: 44px;
108110
}
109111
.text {
110-
@include sofia-pro-medium;
112+
@include sofia-pro-light;
111113
color: $accent-gray;
112-
font-size: 12px;
113-
line-height: 14px;
114+
font-size: $label-small;
115+
line-height: 12px;
114116
margin-top: 11px;
115117
text-transform: uppercase;
116118
text-align: center;
119+
// white-space: nowrap;
117120
word-wrap: break-word;
118121
}
119122
}
@@ -128,7 +131,7 @@
128131
align-items: center;
129132
justify-content: center;
130133
.link {
131-
@include sofia-pro-medium;
134+
@include sofia-pro-regular;
132135
font-size: 12px;
133136
line-height: 14px;
134137
text-decoration: none;

assets/css/directives/skill-tile.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ skill-tile {
2323
}
2424

2525
a:hover {
26-
text-decoration: none;
26+
text-decoration: none;
2727
}
2828

2929
a.hidden {
@@ -100,6 +100,7 @@ skill-tile {
100100
}
101101
}
102102
}
103+
103104
.settings-container {
104105
skill-tile {
105106
a:not(.hidden):hover {

assets/css/directives/tc-sticky.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// .affix {
2+
// position:fixed !important;
3+
// top: 0; //Change this value to match your needs;
4+
// z-index: 10;
5+
// }

assets/css/layout/header.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,11 @@
421421
margin-left: -12px;
422422
background-color: transparent;
423423
}
424+
&.hide {
425+
&:after {
426+
display: none;
427+
}
428+
}
424429
}
425430

426431
// Topcoder logo
@@ -521,6 +526,11 @@
521526
display: inline-block;
522527
color: #a3a3a3;
523528
font-size: 16px;
529+
&.selected {
530+
-moz-box-shadow: inset 0 -4px 0px -1px #0096ff;
531+
-webkit-box-shadow: inset 0 -4px 0px -1px #0096ff;
532+
box-shadow: inset 0 -4px 0px -1px #0096ff;
533+
}
524534
}
525535

526536
.search-wrapper .menu-item-header:before {

assets/css/partials/_tc-buttons.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,12 @@ a.tc-btn, button.tc-btn {
143143
&.tc-btn-s {
144144
height: 30px;
145145
padding: 0 10px;
146-
line-height: 30px;
147-
font-size: 14px;
146+
line-height: 28px;
147+
font-size: 12px;
148+
font-weight: 500;
148149

149150
&:active {
150-
line-height: 31px;
151+
line-height: 29px;
151152
}
152153
}
153154

0 commit comments

Comments
 (0)