From defada45ab5efc7f9a0c209f364f0864d297514a Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Tue, 24 Jul 2018 00:14:29 -0400 Subject: [PATCH] client: adapted code to use HTML tag --- client/css/core-general.styl | 4 +-- client/css/post-content-control.styl | 2 +- client/html/index.htm | 29 ++++++++++--------- client/js/api.js | 4 +-- .../controllers/top_navigation_controller.js | 2 +- client/js/models/top_navigation.js | 24 +++++++-------- client/js/util/uri.js | 2 +- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/client/css/core-general.styl b/client/css/core-general.styl index 75e8224..f6d1382 100644 --- a/client/css/core-general.styl +++ b/client/css/core-general.styl @@ -6,7 +6,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url(/fonts/open_sans.woff2) format('woff2'); + src: local('Open Sans'), local('OpenSans'), url(fonts/open_sans.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; /* make cover entire viewport */ @@ -239,7 +239,7 @@ a .access-key width: 20px height: 20px &.empty - background-image: url('/img/transparency_grid.png') + background-image: url('img/transparency_grid.png') background-repeat: repeat background-size: initial img diff --git a/client/css/post-content-control.styl b/client/css/post-content-control.styl index 857b2ef..329abcd 100644 --- a/client/css/post-content-control.styl +++ b/client/css/post-content-control.styl @@ -1,6 +1,6 @@ .post-container .post-content.transparency-grid img - background: url('/img/transparency_grid.png') + background: url('img/transparency_grid.png') text-align: center .post-content diff --git a/client/html/index.htm b/client/html/index.htm index 7d67ae3..2ebec1c 100644 --- a/client/html/index.htm +++ b/client/html/index.htm @@ -9,23 +9,24 @@ Loading... - - - - - - - - - - - - + + + + + + + + + + + + +
- - + + diff --git a/client/js/api.js b/client/js/api.js index de612f0..07ec5ec 100644 --- a/client/js/api.js +++ b/client/js/api.js @@ -256,7 +256,7 @@ class Api extends events.EventTarget { _getFullUrl(url) { const fullUrl = - ('/api/' + url).replace(/([^:])\/+/g, '$1/'); + ('api/' + url).replace(/([^:])\/+/g, '$1/'); const matches = fullUrl.match(/^([^?]*)\??(.*)$/); const baseUrl = matches[1]; const request = matches[2]; @@ -327,7 +327,7 @@ class Api extends events.EventTarget { let abortFunction = () => {}; let returnedPromise = new Promise((resolve, reject) => { let uploadPromise = this._rawRequest( - '/uploads', request.post, {}, {content: file}, options); + 'uploads', request.post, {}, {content: file}, options); abortFunction = () => uploadPromise.abort(); return uploadPromise.then( response => { diff --git a/client/js/controllers/top_navigation_controller.js b/client/js/controllers/top_navigation_controller.js index fdf8117..9cd70c1 100644 --- a/client/js/controllers/top_navigation_controller.js +++ b/client/js/controllers/top_navigation_controller.js @@ -28,7 +28,7 @@ class TopNavigationController { } _updateNavigationFromPrivileges() { - topNavigation.get('account').url = '/user/' + api.userName; + topNavigation.get('account').url = 'user/' + api.userName; topNavigation.get('account').imageUrl = api.user ? api.user.avatarUrl : null; diff --git a/client/js/models/top_navigation.js b/client/js/models/top_navigation.js index a7c726d..bf2cffe 100644 --- a/client/js/models/top_navigation.js +++ b/client/js/models/top_navigation.js @@ -76,23 +76,23 @@ class TopNavigation extends events.EventTarget { function _makeTopNavigation() { const ret = new TopNavigation(); - ret.add('home', new TopNavigationItem('H', 'Home', '/')); - ret.add('posts', new TopNavigationItem('P', 'Posts', '/posts')); - ret.add('upload', new TopNavigationItem('U', 'Upload', '/upload')); - ret.add('comments', new TopNavigationItem('C', 'Comments', '/comments')); - ret.add('tags', new TopNavigationItem('T', 'Tags', '/tags')); - ret.add('users', new TopNavigationItem('S', 'Users', '/users')); - ret.add('account', new TopNavigationItem('A', 'Account', '/user/{me}')); - ret.add('register', new TopNavigationItem('R', 'Register', '/register')); - ret.add('login', new TopNavigationItem('L', 'Log in', '/login')); - ret.add('logout', new TopNavigationItem('O', 'Logout', '/logout')); - ret.add('help', new TopNavigationItem('E', 'Help', '/help')); + ret.add('home', new TopNavigationItem('H', 'Home', '')); + ret.add('posts', new TopNavigationItem('P', 'Posts', 'posts')); + ret.add('upload', new TopNavigationItem('U', 'Upload', 'upload')); + ret.add('comments', new TopNavigationItem('C', 'Comments', 'comments')); + ret.add('tags', new TopNavigationItem('T', 'Tags', 'tags')); + ret.add('users', new TopNavigationItem('S', 'Users', 'users')); + ret.add('account', new TopNavigationItem('A', 'Account', 'user/{me}')); + ret.add('register', new TopNavigationItem('R', 'Register', 'register')); + ret.add('login', new TopNavigationItem('L', 'Log in', 'login')); + ret.add('logout', new TopNavigationItem('O', 'Logout', 'logout')); + ret.add('help', new TopNavigationItem('E', 'Help', 'help')); ret.add( 'settings', new TopNavigationItem( null, '', - '/settings')); + 'settings')); return ret; } diff --git a/client/js/util/uri.js b/client/js/util/uri.js index a048228..d1cba67 100644 --- a/client/js/util/uri.js +++ b/client/js/util/uri.js @@ -51,7 +51,7 @@ function formatClientLink(...values) { parts.push(escapeParam(value.toString())); } } - return '/' + parts.join('/'); + return parts.join('/'); } module.exports = {