fix issues with unauthenticated field guide browsing

This commit is contained in:
Quincy Larson
2015-04-22 15:50:11 -07:00
parent 237a754289
commit 26d84a21e0
3 changed files with 11 additions and 8 deletions

View File

@ -39,7 +39,11 @@ exports.showAllFieldGuides = function(req, res) {
var data = {}; var data = {};
data.fieldGuideList = resources.allFieldGuideNames(); data.fieldGuideList = resources.allFieldGuideNames();
data.fieldGuideIds = resources.allFieldGuideIds(); data.fieldGuideIds = resources.allFieldGuideIds();
if (req.user && req.user.completedFieldGuides) {
data.completedFieldGuides = req.user.completedFieldGuides; data.completedFieldGuides = req.user.completedFieldGuides;
} else {
data.completedFieldGuides = []
}
res.send(data); res.send(data);
}; };

View File

@ -5,7 +5,7 @@
"description": [ "description": [
"<div class=\"col-xs-12 col-sm-10 col-sm-offset-1\">", "<div class=\"col-xs-12 col-sm-10 col-sm-offset-1\">",
"<h2 class='text-left'>This guide will answer many of your questions about learning to code and getting a coding job.</h2>", "<h2 class='text-left'>This guide will answer many of your questions about learning to code and getting a coding job.</h2>",
"<h3 class='text-left'>You can click the \"Next article\" button to go to your next article.</h3>", "<h3 class='text-left'>If you're logged in, you can click the \"Next article\" button to go to your next article.</h3>",
"<h3 class='text-left'>You can also click the \"Show me all articles\" button to browse all the questions we answer.</h3>", "<h3 class='text-left'>You can also click the \"Show me all articles\" button to browse all the questions we answer.</h3>",
"</div>" "</div>"
] ]

View File

@ -15,14 +15,13 @@ block content
.spacer .spacer
.col-xs-12.col-sm-6.col-sm-offset-3 .col-xs-12.col-sm-6.col-sm-offset-3
.text-center .text-center
if user
.next-field-guide-button.btn.btn-primary.btn-big.btn-block Next article (ctrl + enter) .next-field-guide-button.btn.btn-primary.btn-big.btn-block Next article (ctrl + enter)
.ten-pixel-break .ten-pixel-break
#showAllButton.btn.btn-info.btn-big.btn-block Show me all articles #showAllButton.btn.btn-info.btn-big.btn-block Show me all articles
.spacer
.row
.col-xs-12.text-center
if !user if !user
a.btn.btn-cta.signup-btn.btn-primary(href="/login") Start learning to code (it's free) .ten-pixel-break
a.btn.btn-big.signup-btn.btn-block(href="/login") Start learning to code (it's free)
.spacer .spacer
#show-all-dialog.modal(tabindex='-1') #show-all-dialog.modal(tabindex='-1')
.modal-dialog.animated.fadeInUp.fast-animation .modal-dialog.animated.fadeInUp.fast-animation