remove modal from field guide and create index view
This commit is contained in:
3
app.js
3
app.js
@@ -502,8 +502,7 @@ app.get('/api/codepen/twitter/:screenName', resourcesController.codepenResources
|
|||||||
/**
|
/**
|
||||||
* Field Guide related routes
|
* Field Guide related routes
|
||||||
*/
|
*/
|
||||||
app.get('/field-guide/getFieldGuideList', fieldGuideController.showAllFieldGuides);
|
app.get('/field-guide/all-articles', fieldGuideController.showAllFieldGuides);
|
||||||
|
|
||||||
|
|
||||||
app.get('/field-guide/:fieldGuideName',
|
app.get('/field-guide/:fieldGuideName',
|
||||||
fieldGuideController.returnIndividualFieldGuide
|
fieldGuideController.returnIndividualFieldGuide
|
||||||
|
@@ -54,16 +54,16 @@ exports.returnIndividualFieldGuide = function(req, res, next) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.showAllFieldGuides = function(req, res) {
|
exports.showAllFieldGuides = function(req, res) {
|
||||||
var data = {};
|
var allFieldGuideNamesAndIds = resources.allFieldGuideNamesAndIds();
|
||||||
data.fieldGuideList = resources.allFieldGuideNames();
|
|
||||||
data.fieldGuideIds = resources.allFieldGuideIds();
|
|
||||||
|
|
||||||
|
var completedFieldGuides = [];
|
||||||
if (req.user && req.user.completedFieldGuides) {
|
if (req.user && req.user.completedFieldGuides) {
|
||||||
data.completedFieldGuides = req.user.completedFieldGuides;
|
completedFieldGuides = req.user.completedFieldGuides;
|
||||||
} else {
|
|
||||||
data.completedFieldGuides = [];
|
|
||||||
}
|
}
|
||||||
res.send(data);
|
res.render('field-guide/all-articles', {
|
||||||
|
allFieldGuideNamesAndIds: allFieldGuideNamesAndIds,
|
||||||
|
completedFieldGuides: completedFieldGuides
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.returnNextFieldGuide = function(req, res, next) {
|
exports.returnNextFieldGuide = function(req, res, next) {
|
||||||
|
@@ -436,12 +436,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
allFieldGuideNames: function() {
|
allFieldGuideNamesAndIds: function() {
|
||||||
if (allFieldGuideNames) {
|
if (allFieldGuideNames) {
|
||||||
return allFieldGuideNames;
|
return allFieldGuideNames;
|
||||||
} else {
|
} else {
|
||||||
allFieldGuideNames = fieldGuides.map(function (elem) {
|
allFieldGuideNames = fieldGuides.map(function (elem) {
|
||||||
return { name: elem.name };
|
return { name: elem.name, id: elem._id };
|
||||||
});
|
});
|
||||||
return allFieldGuideNames;
|
return allFieldGuideNames;
|
||||||
}
|
}
|
||||||
|
@@ -220,10 +220,6 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#showAllButton').on('click', function() {
|
|
||||||
$('#show-all-dialog').modal('show');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.next-challenge-button').on('click', function() {
|
$('.next-challenge-button').on('click', function() {
|
||||||
l = location.pathname.split('/');
|
l = location.pathname.split('/');
|
||||||
window.location = '/challenges/' + (parseInt(l[l.length - 1]) + 1);
|
window.location = '/challenges/' + (parseInt(l[l.length - 1]) + 1);
|
||||||
|
24
views/field-guide/all-articles.jade
Normal file
24
views/field-guide/all-articles.jade
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
extends ../layout
|
||||||
|
block content
|
||||||
|
.col-xs-12.col-sm-12.col-md-12
|
||||||
|
.panel.panel-info
|
||||||
|
.panel-heading.text-center Read our Field Guide in any order
|
||||||
|
.panel-body
|
||||||
|
.col-xs-12.col-md-8.col-md-offset-2
|
||||||
|
.col-xs-12.no-right-padding
|
||||||
|
h3
|
||||||
|
ol
|
||||||
|
each fieldGuide in allFieldGuideNamesAndIds
|
||||||
|
if completedFieldGuides.indexOf(fieldGuide.id) > -1
|
||||||
|
.row
|
||||||
|
.hidden-xs.col-sm-3.col-md-2.text-primary.ion-checkmark-circled.padded-ionic-icon.text-center
|
||||||
|
.col-xs-12.col-sm-9.col-md-10
|
||||||
|
li.faded
|
||||||
|
a(href="/field-guide/#{fieldGuide.name}")= fieldGuide.name
|
||||||
|
else
|
||||||
|
.row
|
||||||
|
.hidden-xs.col-sm-3.col-md-2
|
||||||
|
span
|
||||||
|
.col-xs-12.col-sm-9.col-md-10
|
||||||
|
li
|
||||||
|
a(href="/field-guide/#{fieldGuide.name}")= fieldGuide.name
|
@@ -13,18 +13,11 @@ block content
|
|||||||
if user && user.uncompletedFieldGuides.length > 0
|
if user && user.uncompletedFieldGuides.length > 0
|
||||||
.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
|
a.btn.btn-info.btn-big.btn-block(href='/field-guide/all-articles') Show me all articles
|
||||||
if !user
|
if !user
|
||||||
.ten-pixel-break
|
.ten-pixel-break
|
||||||
a.btn.btn-big.signup-btn.btn-block(href="/login") Start learning to code (it's free)
|
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')
|
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header.all-list-header Field Guide Articles
|
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.modal-body
|
|
||||||
include ../partials/field-guide
|
|
||||||
#fieldGuideId.hidden= fieldGuideId
|
#fieldGuideId.hidden= fieldGuideId
|
||||||
script.
|
script.
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@@ -6,6 +6,8 @@ block content
|
|||||||
.panel.panel-info
|
.panel.panel-info
|
||||||
.panel-heading.text-center Nonprofits We Help
|
.panel-heading.text-center Nonprofits We Help
|
||||||
.panel-body
|
.panel-body
|
||||||
|
.col-xs-12.col-md-8.col-md-offset-2
|
||||||
|
.no-right-padding
|
||||||
for nonprofit in nonprofits
|
for nonprofit in nonprofits
|
||||||
.spacer
|
.spacer
|
||||||
.row
|
.row
|
||||||
|
Reference in New Issue
Block a user