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

Commit b6a0289

Browse files
author
Nick Litwin
committed
Add files to see header and footer
1 parent 188f062 commit b6a0289

File tree

67 files changed

+7240
-76
lines changed

Some content is hidden

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

67 files changed

+7240
-76
lines changed

app/index.jade

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,26 @@ html
1313
1414
// build:css styles/app.css
1515
//- inject:css
16+
link(rel="stylesheet", href="assets/css/reset.css")
17+
link(rel="stylesheet", href="assets/css/topcoder.css")
1618
link(rel="stylesheet", href="assets/css/account/account.css")
1719
link(rel="stylesheet", href="assets/css/account/login.css")
1820
link(rel="stylesheet", href="assets/css/account/register.css")
21+
link(rel="stylesheet", href="assets/css/layout/footer.css")
22+
link(rel="stylesheet", href="assets/css/layout/header.css")
23+
link(rel="stylesheet", href="assets/css/peer-review/completed.css")
24+
link(rel="stylesheet", href="assets/css/peer-review/edit.css")
25+
link(rel="stylesheet", href="assets/css/peer-review/peer-review.css")
26+
link(rel="stylesheet", href="assets/css/peer-review/readOnlyScorecard.css")
27+
link(rel="stylesheet", href="assets/css/peer-review/reviewStatus.css")
1928
//- endinject
2029
// endbuild
2130
22-
body(ng-app="topcoder", ng-strict-di)
31+
body(ng-app="topcoder", ng-controller="TopcoderController as main", ng-strict-di)
2332

24-
include ./layout/sidebar.jade
33+
include ./layout/header/sidebar.jade
2534

26-
include ./layout/header.jade
35+
include ./layout/header/header.jade
2736

2837
p This is the top of the index page
2938

@@ -32,24 +41,49 @@ html
3241

3342
p This is the bottom of the index page
3443

35-
include ./layout/footer.jade
44+
include ./layout/footer/footer.jade
45+
46+
script(src="https://cdn.auth0.com/w2/auth0-1.6.4.js", type="text/javascript")
3647

3748
// build:js js/vendor.js
3849
//- bower:js
3950
script(src='../bower_components/angular/angular.js')
4051
script(src='../bower_components/angular-ui-router/release/angular-ui-router.js')
52+
script(src='../bower_components/angular-cookies/angular-cookies.js')
53+
script(src='../bower_components/angular-jwt/dist/angular-jwt.js')
54+
script(src='../bower_components/moment/moment.js')
4155
//- endbower
4256
// endbuild
4357
4458
// build:js js/app.js
4559
//- inject:js
4660
script(src="topcoder.module.js")
4761
script(src="account/account.module.js")
62+
script(src="layout/layout.module.js")
63+
script(src="topcoder.constants.js")
64+
script(src="topcoder.controller.js")
4865
script(src="account/account.routes.js")
49-
script(src="account/login/login.js")
50-
script(src="account/register/register.js")
66+
script(src="services/api.service.js")
67+
script(src="services/auth.service.js")
68+
script(src="services/authtoken.service.js")
69+
script(src="services/helpers.service.js")
70+
script(src="services/profile.service.js")
71+
script(src="services/user.service.js")
72+
script(src="account/login/login.controller.js")
73+
script(src="account/register/register.controller.js")
74+
script(src="layout/header/header.controller.js")
5175
//- endinject
5276
5377
// inject:templates.js
5478
// endinject
5579
// endbuild
80+
81+
script(type="text/javascript").
82+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
83+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
84+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
85+
})(window,document,'script','//www.google-analytics.com/analytics.js','__gaTracker');
86+
__gaTracker('create', 'UA-6340959-1', 'auto');
87+
__gaTracker('set', 'forceSSL', true);
88+
__gaTracker('require', 'displayfeatures');
89+
__gaTracker('send','pageview');

app/layout/header/header.controller.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
angular.module('tc.layout').controller('HeaderController', HeaderController);
55

6-
HeaderController.$inject = ['$window', '$stateParams', 'Auth', 'ENV', 'ProfileService'];
6+
HeaderController.$inject = ['$window', '$stateParams', 'auth', 'CONSTANTS', 'profile'];
77

8-
function HeaderController() {
8+
function HeaderController($window, $stateParams, auth, CONSTANTS, profile) {
99
var vm = this;
10-
$vm.domain = ENV.domain
11-
$vm.login = Auth.login
12-
$vm.isAuth = Auth.isAuthenticated
13-
$vm.logout = function() {
14-
Auth.logout(function() {
10+
vm.domain = CONSTANTS.domain
11+
vm.login = auth.login
12+
vm.isAuth = auth.isAuthenticated
13+
vm.logout = function() {
14+
auth.logout(function() {
1515
if($stateParams.challengeId) {
1616
$window.location.href = 'https://www.' + vm.domain + '/challenge-details/' + $stateParams.challengeId + '/?type=develop';
1717
}

app/layout/header/header.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
header(ng-controller="HeaderController", ng-class="{slided: main.sidebarActive}")
22
.container
33
a(id="topcoder-logo", ng-href="https://www.{{domain}}", title="topcoder")
4-
img(src="content/images/logo.png", alt="Topcoder Logo")
4+
img(src="/images/logo.png", alt="Topcoder Logo")
55

66
nav.top-right
77
ul
8-
li.login(ng-hide="isAuth()") #[a(href="/login") Log In]
8+
li.login(ng-hide="isAuth()") #[a(ui-sref="login") Log In]
99

1010
li.logout(ng-show="isAuth()") #[a(ng-click="logout()") Log Out]
1111

@@ -17,7 +17,7 @@ header(ng-controller="HeaderController", ng-class="{slided: main.sidebarActive}"
1717

1818
li.my-account(ng-show="isAuth()") #[a(ng-click="isActive = !isActive", slide-toggle="#user-widget") My Account]
1919

20-
li.signup(ng-hide="isAuth()") #[a(href="#") Sign Up]
20+
li.signup(ng-hide="isAuth()") #[a(ui-sref="register") Sign Up]
2121

2222
button.bars(type="button", ng-click="main.sidebarActive = !main.sidebarActive")
2323
span.icon-bar
@@ -34,7 +34,7 @@ header(ng-controller="HeaderController", ng-class="{slided: main.sidebarActive}"
3434

3535
li #[a.blog(ng-href="https://www.{{domain}}/blog/") Blog]
3636

37-
a#signup(ng-hide="isAuth()", href="#") Sign Up
37+
a#signup(ng-hide="isAuth()", ui-sref="register") Sign Up
3838
a#my-account(ng-show="isAuth()", ng-click="isActive = !isActive", ng-init="isActive = false", slide-toggle="#user-widget") My Account
3939
i(ng-class="{'active': isActive}")
4040

app/layout/layout.module.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@
44
var dependencies = [];
55

66
angular
7-
.module('tc.layout', dependencies)
8-
.run(appRun);
9-
10-
appRun.$inject = ['$rootScope', '$state'];
11-
12-
function appRun($rootScope, $state) {
13-
// Attaching $state to the $rootScope allows us to access the
14-
// current state in index.html (see div with ui-view on the index page)
15-
$rootScope.$state = $state;
16-
}
7+
.module('tc.layout', dependencies);
178

189
})();

app/services/api.service.js

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

66
api.$inject = ['$http'];
77

8-
function api() {
8+
function api($http) {
99
var service = {
1010
requestHandler: requestHandler
1111
};

app/services/auth.service.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
angular.module('topcoder').factory('auth', auth);
55

6-
auth.$inject = ['CONSTANTS', '$window', 'AuthToken', '$state', '$stateParams',' ApiService'];
6+
auth.$inject = ['CONSTANTS', '$window', 'authtoken', '$state', '$stateParams','api'];
77

8-
function auth() {
8+
function auth(CONSTANTS, $window, authtoken, $state, $stateParams, api) {
99
var auth0 = new Auth0({
1010
domain: CONSTANTS.auth0Domain,
1111
clientID: CONSTANTS.clientId,
@@ -35,14 +35,14 @@
3535
if (err) {
3636
errorCallback(err)
3737
} else {
38-
AuthToken.setToken(id_token);
39-
successCallback( )profile, id_token, access_token, state);
38+
authtoken.setToken(id_token);
39+
successCallback(profile, id_token, access_token, state);
4040
}
4141
});
4242
}
4343

4444
function logout(successCallback) {
45-
AuthToken.removeToken();
45+
authtoken.removeToken();
4646

4747
if (typeof(successCallback) === 'function') {
4848
successCallback();
@@ -51,7 +51,7 @@
5151
reload: true,
5252
inherit: false,
5353
notify: true
54-
}
54+
});
5555
}
5656
}
5757

@@ -60,7 +60,7 @@
6060
// required: ["firstName", "lastName", "handle", "country", "email"],
6161
// optional: ["password", "socialProviderId", "socialUserName", "socialEmail", "socialEmailVerified", "regSource", "socialUserId", "utm_source", "utm_medium", "utm_campaign"]
6262
var url = CONSTANTS.API_URL_V2 + '/users/';
63-
ApiService.requestHandler('POST', url, JSON.stringify(reg));
63+
api.requestHandler('POST', url, JSON.stringify(reg));
6464
}
6565

6666
function checkLogin() {
@@ -70,7 +70,7 @@
7070
}
7171

7272
function isAuthenticated() {
73-
return !!AuthToken.getToken();
73+
return !!authtoken.getToken();
7474
}
7575
}
7676
})();

app/services/authtoken.service.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
authtoken.$inject = ['CONSTANTS', '$window', '$cookies'];
77

8-
function authtoken() {
8+
function authtoken(CONSTANTS, $window, $cookies) {
99
var tokenKey = 'tcjwt';
1010

1111
var service = {
@@ -22,6 +22,7 @@
2222
}
2323

2424
function getToken() {
25+
console.log('here');
2526
return $cookies.get(tokenKey);
2627
}
2728

app/services/profile.service.js

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

44
angular.module('topcoder').factory('profile', profile);
55

6-
profile.$inject = ['CONSTANTS', 'ApiService', 'UserService'];
6+
profile.$inject = ['CONSTANTS', 'api', 'user'];
77

8-
function profile() {
8+
function profile(CONSTANTS, api, user) {
99
var service = {
1010
getUserProfile: getUserProfile
1111
};
@@ -14,9 +14,9 @@
1414
///////////////
1515

1616
function getUserProfile() {
17-
UserService.getUsername()
17+
user.getUsername()
1818
.then(function(response) {
19-
ApiService.requestHandler('GET', CONSTANTS.API_URL_V2 + '/users/' + response.data.handle);
19+
api.requestHandler('GET', CONSTANTS.API_URL_V2 + '/users/' + response.data.handle);
2020
});
2121
}
2222
}

app/services/user.service.js

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

44
angular.module('topcoder').factory('user', user);
55

6-
user.$inject = ['CONSTANTS', 'ApiService', 'jwtHelper', 'AuthToken'];
6+
user.$inject = ['CONSTANTS', 'api'];
77

8-
function user() {
8+
function user(CONSTANTS, api) {
99
var service = {
1010
getUsername: getUsername
1111
};
@@ -14,8 +14,8 @@
1414
///////////////
1515

1616
function getUsername() {
17-
url = CONSTANTS.API_URL_V2 + '/user/identity';
18-
ApiService.requestHandler('GET', url);
17+
var url = CONSTANTS.API_URL_V2 + '/user/identity';
18+
api.requestHandler('GET', url);
1919
}
2020
}
2121

app/topcoder.constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function() {
22
'use strict';
33

4-
app.module('topcoder').constant('CONSTANTS', {
4+
angular.module('topcoder').constant('CONSTANTS', {
55
name: 'development',
66
API_URL: 'https://api.topcoder-dev.com/v3',
77
API_URL_V2: 'https://api.topcoder-dev.com/v2',

app/topcoder.controller.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,41 @@
33

44
angular.module('topcoder').controller('TopcoderController', TopcoderController);
55

6-
TopcoderController.$inject = ['$window', '$stateParams', 'Auth', 'CONSTANTS', 'ProfileService'];
6+
TopcoderController.$inject = ['$window', '$stateParams', 'auth', 'CONSTANTS', 'profile'];
77

8-
function TopcoderController() {
8+
function TopcoderController($window, $stateParams, auth, CONSTANTS, profile) {
99
var vm = this;
1010
vm.domain = CONSTANTS.domain;
1111
vm.sidebarActive = false;
1212

1313
vm.logout = function() {
14-
Auth.logout(function() {
14+
auth.logout(function() {
1515
if($stateParams.challengeId) {
1616
$window.location.href = 'https://www.' + vm.domain + '/challenge-details/' + $stateParams.challengeId + '/?type=develop';
1717
}
1818
});
1919
};
2020

21-
ProfileService.getUserProfile()
22-
.then(function(response) {
23-
vm.profile = response.data;
24-
vm.handleColor = 'color: #000000';
25-
26-
// TODO: Should this be moved to a helper function?
27-
var highestRating = 0;
28-
angular.forEach(response.data.ratingSummary, function(rating) {
29-
if(rating.rating > highestRating) {
30-
highestRating = rating.rating;
31-
vm.handleColor = rating.colorStyle;
32-
}
33-
});
34-
35-
if(vm.profile.photoLink === '') {
36-
vm.profile.photoLink = '//community.topcoder.com/i/m/nophoto_login.gif';
37-
} else {
38-
vm.profile.photoLink = '//community.topcoder.com' + vm.profile.photoLink;
39-
}
40-
});
21+
// profile.getUserProfile()
22+
// .then(function(response) {
23+
// vm.profile = response.data;
24+
// vm.handleColor = 'color: #000000';
25+
26+
// // TODO: Should this be moved to a helper function?
27+
// var highestRating = 0;
28+
// angular.forEach(response.data.ratingSummary, function(rating) {
29+
// if(rating.rating > highestRating) {
30+
// highestRating = rating.rating;
31+
// vm.handleColor = rating.colorStyle;
32+
// }
33+
// });
34+
35+
// if(vm.profile.photoLink === '') {
36+
// vm.profile.photoLink = '//community.topcoder.com/i/m/nophoto_login.gif';
37+
// } else {
38+
// vm.profile.photoLink = '//community.topcoder.com' + vm.profile.photoLink;
39+
// }
40+
// });
4141

4242
}
4343
})();

app/topcoder.module.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
'use strict';
33

44
var dependencies = [
5+
'tc.layout',
56
'tc.account',
6-
'ui.router'
7+
'ui.router',
8+
'ngCookies'
79
];
810

911
angular

assets/css/account/account.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
p {
2-
color: red;
3-
}
42

5-
h1 {
6-
color: red;
73
}

0 commit comments

Comments
 (0)