From 94a9bcea5ad83e72ee86c538c924d4b571c9499d Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 25 Mar 2016 13:48:42 -0700 Subject: [PATCH 1/3] Fix article loading on direct link to wiki --- server/boot/t-wiki.js | 10 ++++++++-- server/views/wiki/show.jade | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/server/boot/t-wiki.js b/server/boot/t-wiki.js index 254ee4b619..d19b6b1ccd 100644 --- a/server/boot/t-wiki.js +++ b/server/boot/t-wiki.js @@ -1,11 +1,17 @@ module.exports = function(app) { var router = app.loopback.Router(); router.get('/wiki/*', showWiki); - router.get('/wiki', showWiki); + router.get('/wiki', (req, res) => res.redirect(301, '/wiki/en/')); app.use(router); function showWiki(req, res) { - res.render('wiki/show', { title: 'Wiki | Free Code Camp' }); + res.render( + 'wiki/show', + { + title: 'Wiki | Free Code Camp', + path: req.path.replace(/^\/wiki/, '') + } + ); } }; diff --git a/server/views/wiki/show.jade b/server/views/wiki/show.jade index 5b2427e056..f57f17555e 100644 --- a/server/views/wiki/show.jade +++ b/server/views/wiki/show.jade @@ -2,6 +2,10 @@ extends ../layout-wide block content iframe#wikiFrame(frameborder='no') script. - var lang = window.location.toString().match(/\/\w{2}\//); - lang = (lang) ? lang[0] : '/en/'; - $('#wikiFrame').attr('src','//freecodecamp.github.io/wiki' + lang); + var requestedPath = !{JSON.stringify(path) || ''}; + var lang = window.location.toString().match(/\/\w{2}\//); + lang = (lang) ? lang[0] : '/en/'; + $('#wikiFrame').attr( + 'src', + '//freecodecamp.github.io/wiki' + (requestedPath ? requestedPath : lang) + ); From ee1c017b0d2132d2ad6509ee23c6d05038c54dd2 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 2 Apr 2016 00:56:40 -0700 Subject: [PATCH 2/3] Sync wiki article urls with main site --- server/views/wiki/show.jade | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/views/wiki/show.jade b/server/views/wiki/show.jade index f57f17555e..f8cf997089 100644 --- a/server/views/wiki/show.jade +++ b/server/views/wiki/show.jade @@ -2,10 +2,19 @@ extends ../layout-wide block content iframe#wikiFrame(frameborder='no') script. + var wikiUrl = '//freecodecamp.github.io/wiki'; + var wikiOrigin = /https?:\/\/freecodecamp.github.io/; var requestedPath = !{JSON.stringify(path) || ''}; var lang = window.location.toString().match(/\/\w{2}\//); lang = (lang) ? lang[0] : '/en/'; $('#wikiFrame').attr( 'src', - '//freecodecamp.github.io/wiki' + (requestedPath ? requestedPath : lang) + wikiUrl + (requestedPath ? requestedPath : lang) ); + window.addEventListener('message', function(e) { + if (!wikiOrigin.test(e.origin)) { + return null; + } + history.replaceState(history.state, null, e.data); + return null; + }); From a2466d77b39026e0a2637bcd2adeaebd473716be Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 4 Apr 2016 22:03:18 -0700 Subject: [PATCH 3/3] fix button colors from issue #7903 --- client/less/lib/bootstrap-social/bootstrap-social.less | 2 +- server/views/account/settings.jade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/less/lib/bootstrap-social/bootstrap-social.less b/client/less/lib/bootstrap-social/bootstrap-social.less index a333b57a08..2c3e60f44c 100755 --- a/client/less/lib/bootstrap-social/bootstrap-social.less +++ b/client/less/lib/bootstrap-social/bootstrap-social.less @@ -86,7 +86,7 @@ } } -.btn-social(@color-bg, @color: #fff) { +.btn-social(@color-bg, @color: @color-bg) { background-color: @color-bg; .button-variant(@color, @color-bg, rgba(0,0,0,.2)); } diff --git a/server/views/account/settings.jade b/server/views/account/settings.jade index de83cdee58..822aa10d24 100644 --- a/server/views/account/settings.jade +++ b/server/views/account/settings.jade @@ -26,7 +26,7 @@ block content i.fa.fa-linkedin | Add my LinkedIn to my portfolio if (!user.google) - a.btn.btn-lg.btn-block.btn-google-plus.btn-link-social(href='/link/google') + a.btn.btn-lg.btn-block.btn-google.btn-link-social(href='/link/google') i.fa.fa-google-plus | Add my Google+ to my portfolio .spacer