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

Commit 9876ed3

Browse files
author
Victor George
committed
Fixes with layout;
Merge branch 'dev' of https://github.com/appirio-tech/topcoder-app into profile-layout-fixes # By Tom Ladendorf (4) and Parth Shah (2) # Via Tom Ladendorf (4) and Parth Shah (2) * 'dev' of https://github.com/appirio-tech/topcoder-app: cleanup made nav logic more complete fixed skill grid for desktop a couple cursor fixes moving user to v3 endpoint adding transclude option to make it more dynamic Conflicts: assets/css/profile/about.scss
2 parents 0cb1d46 + f2115d7 commit 9876ed3

File tree

12 files changed

+142
-91
lines changed

12 files changed

+142
-91
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/page-state-header/page-state-header.directive.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
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})")

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
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: '@',

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/subtrack/subtrack.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.profile-subtrack-container(ng-cloak, ng-show="profileVm.status.stats === 'ready'")
22
.content
3-
43
.page-header
54
page-state-header(handle="{{vm.userHandle}}", page-title="{{vm.pageName}}", hide-money="true", show-back-link="true", default-state="dashboard")
6-
5+
.nav-right
6+
i.fa.fa-th(ng-click="vm.showNav()")
77
tc-tab-set
88
tc-tab(heading="{{vm.tabs[0]}}")
99
.subtrack-stats

app/services/api.service.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
var service = {
1010
requestHandler: requestHandler,
1111
restangularV2: _getRestangularV2(),
12-
restangularV3: _getRestangularV3()
12+
restangularV3: _getRestangularV3(),
13+
getApiServiceProvider: getApiServiceProvider
1314
};
1415
return service;
1516

@@ -64,8 +65,19 @@
6465
return _restangular;
6566
}
6667

67-
function _getRestangularV3() {
68-
var baseUrl = CONSTANTS.API_URL;
68+
function getApiServiceProvider(type) {
69+
switch (type.toUpperCase()) {
70+
case 'AUTH':
71+
case 'USER':
72+
debugger;
73+
return _getRestangularV3(CONSTANTS.AUTH_API_URL);
74+
default:
75+
return _getRestangularV3();
76+
}
77+
}
78+
79+
function _getRestangularV3(baseUrl) {
80+
baseUrl = baseUrl || CONSTANTS.API_URL;
6981
var _restangular = Restangular.withConfig(function(Configurer) {
7082
Configurer
7183
.setBaseUrl(baseUrl)

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/services/user.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
function UserService(CONSTANTS, ApiService, $injector, AuthTokenService, UserPrefStore) {
99

10-
var api = ApiService.restangularV3;
10+
var api = ApiService.getApiServiceProvider('USER');
1111

1212
var _config = {
1313
cache: false,

assets/css/directives/page-state-header.directive.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@
9898
align-items: center;
9999
justify-content: space-between;
100100

101-
102101
.page-info {
103102
order: 2;
103+
display: flex;
104+
flex-direction: row;
104105
h1 {
105106
font-size: 36px;
106107
line-height: 43px;
@@ -112,4 +113,4 @@
112113
}
113114
}
114115
}
115-
}
116+
}

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/profile/subtrack.scss

Lines changed: 79 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,83 +12,87 @@
1212

1313
margin: 30px auto 40px;
1414

15-
16-
.nav {
17-
@include module-full-width;
18-
width: 100%;
19-
// max-width: 1242px;
20-
// background: white;
21-
height: 100px;
22-
// margin: 30px auto 40px;
23-
// margin-right: auto;
24-
display: flex;
25-
flex-direction: row;
26-
justify-content: space-between;
27-
align-items: center;
28-
// margin-bottom: 10px;
29-
30-
.right {
31-
width: 15px;
32-
margin-right: 50px;
33-
.subtrack {
34-
display: block;
35-
color: $primary;
36-
font-weight: 700;
37-
text-align: center;
38-
text-transform: uppercase;
39-
}
40-
41-
i {
42-
color: #a3a3ae;
43-
font-size: 19px;
44-
cursor: pointer;
45-
&:hover {
46-
color: black;
47-
}
48-
}
15+
.nav-right {
16+
padding-top: 15px;
17+
padding-left: 15px;
4918
}
19+
// .nav {
20+
// @include module-full-width;
21+
// width: 100%;
22+
// // max-width: 1242px;
23+
// // background: white;
24+
// height: 100px;
25+
// // margin: 30px auto 40px;
26+
// // margin-right: auto;
27+
// display: flex;
28+
// flex-direction: row;
29+
// justify-content: space-between;
30+
// align-items: center;
31+
// // margin-bottom: 10px;
32+
33+
// .right {
34+
// width: 15px;
35+
// margin-right: 50px;
36+
// .subtrack {
37+
// display: block;
38+
// color: $primary;
39+
// font-weight: 700;
40+
// text-align: center;
41+
// text-transform: uppercase;
42+
// }
43+
44+
// i {
45+
// color: #a3a3ae;
46+
// font-size: 19px;
47+
// cursor: pointer;
48+
// &:hover {
49+
// color: black;
50+
// }
51+
// }
52+
// }
53+
54+
// .handle {
55+
// a {
56+
// &:hover {
57+
// color: $primary;
58+
// }
59+
// }
60+
// }
61+
62+
63+
// }
64+
// .tabs {
65+
// background-color: $gray-lightest;
66+
// display: flex;
67+
// height: 60px;
68+
// flex-direction: row;
69+
// justify-content: center;
70+
// padding-top: 20px;
71+
// padding-bottom: 16px;
72+
// border-top: 1px solid $gray-light;
73+
// border-bottom: 1px solid $gray-light;
74+
// a {
75+
// color: #a3a3ae;
76+
// width: 140px;
77+
// height: 30px;
78+
// // padding-top: 6px;
79+
// text-align: center;
80+
// @include sofia-pro-medium;
81+
// font-size: 18px;
82+
// line-height: 24px;
83+
// text-transform: uppercase;
84+
// &.left {
85+
// }
86+
// &.right {
87+
// }
88+
// &.selected {
89+
// color: $gray-darkest;
90+
// padding-bottom: 36px;
91+
// border-bottom: solid 2px $primary;
92+
// }
93+
// }
94+
// }
5095

51-
.handle {
52-
a {
53-
&:hover {
54-
color: $primary;
55-
}
56-
}
57-
}
58-
59-
60-
}
61-
.tabs {
62-
background-color: $gray-lightest;
63-
display: flex;
64-
height: 60px;
65-
flex-direction: row;
66-
justify-content: center;
67-
padding-top: 20px;
68-
padding-bottom: 16px;
69-
border-top: 1px solid $gray-light;
70-
border-bottom: 1px solid $gray-light;
71-
a {
72-
color: #a3a3ae;
73-
width: 140px;
74-
height: 30px;
75-
// padding-top: 6px;
76-
text-align: center;
77-
@include sofia-pro-medium;
78-
font-size: 18px;
79-
line-height: 24px;
80-
text-transform: uppercase;
81-
&.left {
82-
}
83-
&.right {
84-
}
85-
&.selected {
86-
color: $gray-darkest;
87-
padding-bottom: 36px;
88-
border-bottom: solid 2px $primary;
89-
}
90-
}
91-
}
9296
.subtrack-stats {
9397
// @include module-l;
9498
width: 100%;

0 commit comments

Comments
 (0)