make further improvements to wiki and start new show view for nonprofits
This commit is contained in:
16
app.js
16
app.js
@ -351,6 +351,16 @@ app.get('/nonprofits/your-nonprofit-project-application-has-been-submitted', non
|
||||
|
||||
app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions);
|
||||
|
||||
app.get(
|
||||
'/nonprofits/:nonprofitName',
|
||||
nonprofitController.returnIndividualNonprofit
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/nonprofits',
|
||||
nonprofitController.showAllNonprofits
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/done-with-first-100-hours',
|
||||
passportConf.isAuthenticated,
|
||||
@ -496,6 +506,8 @@ app.get('/bonfire', function(req, res) {
|
||||
res.redirect(301, '/playground');
|
||||
});
|
||||
|
||||
app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
||||
|
||||
/**
|
||||
* Wiki related routes
|
||||
*/
|
||||
@ -507,10 +519,9 @@ app.get(
|
||||
|
||||
app.get(
|
||||
'/wiki',
|
||||
wikiController.showAllWikis
|
||||
wikiController.returnHomeWiki
|
||||
);
|
||||
|
||||
app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
||||
|
||||
/**
|
||||
* Courseware related routes
|
||||
@ -548,6 +559,7 @@ app.post('/account/delete', userController.postDeleteAccount);
|
||||
app.get('/account/unlink/:provider', userController.getOauthUnlink);
|
||||
|
||||
app.get('/sitemap.xml', resourcesController.sitemap);
|
||||
|
||||
/**
|
||||
* OAuth sign-in routes.
|
||||
*/
|
||||
|
@ -1,17 +1,8 @@
|
||||
var async = require('async'),
|
||||
User = require('../models/User'),
|
||||
Challenge = require('./../models/Challenge'),
|
||||
Bonfire = require('./../models/Bonfire'),
|
||||
Story = require('./../models/Story'),
|
||||
Comment = require('./../models/Comment'),
|
||||
resources = require('./resources.json'),
|
||||
steps = resources.steps,
|
||||
secrets = require('./../config/secrets'),
|
||||
moment = require('moment'),
|
||||
https = require('https'),
|
||||
debug = require('debug')('freecc:cntr:resources'),
|
||||
cheerio = require('cheerio'),
|
||||
request = require('request'),
|
||||
R = require('ramda');
|
||||
|
||||
exports.nonprofitsHome = function(req, res) {
|
||||
@ -99,3 +90,39 @@ exports.otherSolutions = function(req, res) {
|
||||
title: 'Here are some other possible solutions for you'
|
||||
});
|
||||
};
|
||||
|
||||
exports.returnIndividualNonprofit = function(req, res, next) {
|
||||
var dashedName = req.params.nonprofitName;
|
||||
|
||||
var nonprofitName = dashedName.replace(/\-/g, ' ');
|
||||
|
||||
Nonprofit.find({'name': new RegExp(nonprofitName, 'i')}, function(err, nonprofit) {
|
||||
if (err) {
|
||||
next(err);
|
||||
}
|
||||
|
||||
if (nonprofit.length < 1) {
|
||||
req.flash('errors', {
|
||||
msg: "404: We couldn't find a nonprofit with that name. Please double check the name."
|
||||
});
|
||||
|
||||
return res.redirect('/nonprofits');
|
||||
}
|
||||
|
||||
nonprofit = nonprofit.pop();
|
||||
var dashedNameFull = nonprofit.name.toLowerCase().replace(/\s/g, '-');
|
||||
if (dashedNameFull != dashedName) {
|
||||
return res.redirect('../nonprofit/' + dashedNameFull);
|
||||
}
|
||||
res.render('nonprofits/show', {
|
||||
title: nonprofit.name,
|
||||
description: nonprofit.description.join('')
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.showAllNonprofits = function(req, res) {
|
||||
var data = {};
|
||||
data.nonprofitList = resources.allNonprofitNames();
|
||||
res.send(data);
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ exports.returnIndividualWiki = function(req, res, next) {
|
||||
}
|
||||
|
||||
wiki = wiki.pop();
|
||||
var dashedNameFull = wiki.name.toLowerCase().replace(/\s/g, '-');
|
||||
var dashedNameFull = wiki.name.toLowerCase().replace(/\s/g, '-').replace(/\?/g, '');
|
||||
if (dashedNameFull != dashedName) {
|
||||
return res.redirect('../wiki/' + dashedNameFull);
|
||||
}
|
||||
@ -39,3 +39,31 @@ exports.showAllWikis = function(req, res) {
|
||||
data.wikiList = resources.allWikiNames();
|
||||
res.send(data);
|
||||
};
|
||||
|
||||
exports.returnHomeWiki = function(req, res) {
|
||||
var dashedName = req.params.wikiName;
|
||||
|
||||
Wiki.find({'name': 'A Guide to our Wiki'}, function(err, wiki) {
|
||||
if (err) {
|
||||
next(err);
|
||||
}
|
||||
|
||||
if (wiki.length < 1) {
|
||||
req.flash('errors', {
|
||||
msg: "404: We couldn't find a wiki entry with that name. Please double check the name."
|
||||
});
|
||||
|
||||
return res.redirect('/wiki');
|
||||
}
|
||||
|
||||
wiki = wiki.pop();
|
||||
var dashedNameFull = wiki.name.toLowerCase().replace(/\s/g, '-');
|
||||
if (dashedNameFull != dashedName) {
|
||||
return res.redirect('../wiki/' + dashedNameFull);
|
||||
}
|
||||
res.render('wiki/show', {
|
||||
title: wiki.name,
|
||||
description: wiki.description.join('')
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -47,7 +47,7 @@
|
||||
"method-override": "^2.3.0",
|
||||
"moment": "^2.8.4",
|
||||
"mongodb": "^1.4.33",
|
||||
"mongoose": "^4.0.0",
|
||||
"mongoose": "^4.0.1",
|
||||
"mongoose-long": "0.0.2",
|
||||
"morgan": "^1.5.0",
|
||||
"newrelic": "^1.13.3",
|
||||
|
@ -1,4 +1,138 @@
|
||||
[
|
||||
{
|
||||
"_id": "bd7158d9c441eddfaeb5bdef",
|
||||
"name": "A Guide to our Wiki",
|
||||
"description": [
|
||||
"<div class=\"col-xs-12 col-sm-10 col-sm-offset-1\">",
|
||||
"<h2 class='text-center'>We have a variety of resources to answer your many questions.</h2>",
|
||||
"<h3 class='text-center'>Click the \"Show all Wiki Articles\" button below and browse the topics we cover</h3>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c440eddfaeb5bdef",
|
||||
"name": "What will I learn, and in what sequence?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\">First, you'll learn basic web design tools like:",
|
||||
" <ul>",
|
||||
" <li class=\"landing-p\">• HTML - the structure of web pages</li>",
|
||||
" <li class=\"landing-p\">• CSS - the visual style of web pages</li>",
|
||||
" <li class=\"landing-p\">• Bootstrap - a \"responsive design\" tool that helps your websites look great on tablets and phones</li>",
|
||||
" <li class=\"landing-p\">• jQuery - an easy tool for controlling content in the browser</li>",
|
||||
" <li class=\"landing-p\">• Chrome DevTools - a tool for understanding and debugging websites, right in your browser</li>",
|
||||
" </ul>",
|
||||
" </p>",
|
||||
" <p class=\"landing-p\">Then you'll learn computer science and the art of programming:",
|
||||
" <ul>",
|
||||
" <li class=\"landing-p\">• JavaScript - the one programming language that all web browsers use</li>",
|
||||
" <li class=\"landing-p\">• Algorithms - step-by-step recipes for getting things done</li>",
|
||||
" <li class=\"landing-p\">• Automated Testing - write tests to test the limits of your code</li>",
|
||||
" </ul>",
|
||||
" </p>",
|
||||
" <p class=\"landing-p\">You'll spend the last half of Free Code Camp using Agile Methodologies and Full Stack JavaScript to build projects for nonprofits:",
|
||||
" <ul>",
|
||||
" <li class=\"landing-p\">• Agile - a set of software development principles that focus the design and production of a project on the needs of its users</li>",
|
||||
" <li class=\"landing-p\">• Git - a version control system for saving and sharing your projects</li>",
|
||||
" <li class=\"landing-p\">• MongoDB - a popular non-relational database</li>",
|
||||
" <li class=\"landing-p\">• Angular.js - a tool for making exciting web interfaces</li>",
|
||||
" <li class=\"landing-p\">• Express.js - a powerful web development framework</li>",
|
||||
" <li class=\"landing-p\">• Node.js - a JavaScript-based web server</li>",
|
||||
" </ul>",
|
||||
" </p>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c439eddfaeb5bdef",
|
||||
"name": "Will I be ready to get a software engineer job after this?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\">At the end of Free Code Camp, you will have pair programmed around 1,000 hours with dozens of other students, built a portfolio of projects that people are actively using, and a roster of glowing references from nonprofits you've helped. This is more coding than most coding bootcamps provide, and on average, 75% of bootcamp graduates get software engineering jobs within 6 months, and earn an average annual salary of $76,000.</p>",
|
||||
" <img src=\"https://s3.amazonaws.com/freecodecamp/table-of-earnings.png\" alt=\"A chart showing the average earnings of coding bootcamp graduates\" class=\"img-center img-responsive\"/>",
|
||||
"</br>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c434eddfaeb5bdef",
|
||||
"name": "How long does Free Code Camp take?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\">It takes about 1,000 hours of coding to develop the skills you'll need to get an entry level software engineering job. Most coding bootcamps try to jam all this into 12 weeks of intensive study. Free Code Camp is fully online, and there will always be other people at your skill level that you can pair program with, so you can learn at your own pace. Here are some example coding schedules:</p>",
|
||||
" <table class=\"table\">",
|
||||
" <thead>",
|
||||
" <th>Time budgeted</th>",
|
||||
" <th class=\"hidden-xs\">Hours per week</th>",
|
||||
" <th>Weeks to complete</th>",
|
||||
" </thead>",
|
||||
" <tr class=\"info\">",
|
||||
" <td>Weekends</td>",
|
||||
" <td class=\"hidden-xs\">10 hours/week</td>",
|
||||
" <td>100 weeks (2 years)</td>",
|
||||
" </tr>",
|
||||
" <tr class=\"success\">",
|
||||
" <td>Nights and Weekends</td>",
|
||||
" <td class=\"hidden-xs\">20 hours/week</td>",
|
||||
" <td>50 weeks (1 year)</td>",
|
||||
" </tr>",
|
||||
" <tr class=\"warning\">",
|
||||
" <td>Full time</td>",
|
||||
" <td class=\"hidden-xs\">40 hours/week</td>",
|
||||
" <td>25 weeks (6 months)</td>",
|
||||
" </tr>",
|
||||
" <tr class=\"danger\">",
|
||||
" <td>Traditional Bootcamp Pacing</td>",
|
||||
" <td class=\"hidden-xs\">80 hours/week</td>",
|
||||
" <td>12 weeks (3 months)</td>",
|
||||
" </tr>",
|
||||
" </table>",
|
||||
"<br>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c438eddfaeb5bdef",
|
||||
"name": "Why does Free Code Camp use JavaScript instead of Ruby or Python?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\">Like JavaScript, Ruby and Python are high-level scripting languages that can be used for full stack web development. But even if you learned these languages, you'd still need to learn JavaScript. That's because JavaScript is the only language that runs in web browsers. JavaScript has been around for 20 years, and it is still growing in popularity. Because of this, JavaScript has more tools and online learning resources than any other language.</p>",
|
||||
" <img src=\"https://s3.amazonaws.com/freecodecamp/github-repo-growth.png\" style=\"max-height: 355px;\" alt=\"A chart showing the volume of new GitHub repositories by year, with JavaScript growing and most languages declining.\" class=\"img-center img-responsive\"/>",
|
||||
"<br>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c437eddfaeb5bdef",
|
||||
"name": "What's pair programming, and what's so special about it?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\">Pair programming is where two people code together on one computer. You discuss different approaches to solving problems, and keep each other motivated. The result is better code than either of you could have written by yourselves. Because of its benefits, many engineers pair program full time. And it's the best way to learn coding. Thanks to tools that allow two people to share mouse and keyboard inputs, you can pair program with a friend without needing to be in the same room.</p>",
|
||||
" <p class=\"landing-p\">By pair programming with other Free Code Camp students on our coding challenges. Eventually, you'll work with people at nonprofits to build real-life software solutions.</p>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c436eddfaeb5bdef",
|
||||
"name": "If Free Code Camp is free, how does it make money?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\"> We are completely free for both students and for nonprofits.</p>",
|
||||
" <p class=\"landing-p\">Our name is Free Code Camp. We are a free code camp. If you had to pay us (or sign over future earnings), we'd have to change our name. And we are not going to do that.</p>",
|
||||
" <p class=\"landing-p\"> We don't make any money at all. Everyone working on our community and our open source projects is a volunteer.</p>",
|
||||
" <p class=\"landing-p\"> We plan to eventually cover our operational costs by earning job placement bonuses from companies who hire our graduates. Note that we will not actually garnish any wages from our graduates - employers are already paying recruiters thousands of dollars to find successful candidates. Employers will simply pay the recruitment bonus to Free Code Camp instead of paying a recruiter.</p>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c435eddfaeb5bdef",
|
||||
"name": "Does Free Code Camp have an application process?",
|
||||
"description": [
|
||||
"<div class=\"text-left col-xs-12 col-md-10 col-md-offset-1\">",
|
||||
" <p class=\"landing-p\">Unlike coding bootcamps, anyone can study at Free Code Camp. We're not going to tell you that you can't become a software engineer. We believe the only person who should be able to tell you that is you.</p>",
|
||||
" <p class=\"landing-p\">If you persevere, and keep working through our challenges and nonprofit projects, you will become an employable software engineer.</p>",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "bd7158d9c442eddfaeb5bdef",
|
||||
"name": "Global Control Shortcuts for Mac",
|
||||
|
26
views/nonprofits/show.jade
Normal file
26
views/nonprofits/show.jade
Normal file
@ -0,0 +1,26 @@
|
||||
extends ../layout
|
||||
block content
|
||||
script.
|
||||
var challengeName = 'Nonprofits View';
|
||||
.col-xs-12.col-sm-12.col-md-12
|
||||
.panel.panel-info
|
||||
.panel-heading.text-center
|
||||
h1= title
|
||||
.panel-body
|
||||
div!= description
|
||||
.spacer
|
||||
.text-center
|
||||
#showAllButton.btn.btn-info.btn-big Show all Nonprofits Projects
|
||||
.spacer
|
||||
.row
|
||||
.col-xs-12.text-center
|
||||
if !user
|
||||
a.btn.btn-cta.signup-btn.btn-primary(href="/login") Start learning to code (it's free)
|
||||
.spacer
|
||||
#all-challenges-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeInUp.fast-animation
|
||||
.modal-content
|
||||
.modal-header.all-list-header Nonprofit Projects
|
||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||
.modal-body
|
||||
include ../partials/nonprofits
|
24
views/partials/nonprofits.jade
Normal file
24
views/partials/nonprofits.jade
Normal file
@ -0,0 +1,24 @@
|
||||
h3
|
||||
ol#nonprofitsList
|
||||
script(src='/js/lib/ramda/ramda.min.js')
|
||||
script.
|
||||
var getLinkedName = function getLinkedName(name) {
|
||||
// ensure name is a string
|
||||
name = name + '';
|
||||
return name.toLowerCase().replace(/\s/g, '-');
|
||||
}
|
||||
$.ajax({
|
||||
url: '/wiki/getNonprofitsList',
|
||||
type: 'GET'
|
||||
})
|
||||
.success(
|
||||
function(data) {
|
||||
var docfrag = document.createDocumentFragment();
|
||||
for (var i = 0; i < data.nonprofitsList.length; i++) {
|
||||
var li = document.createElement("li");
|
||||
var linkedName = getLinkedName(data.nonprofitsList[i].name);
|
||||
$(li).html("<a href='/nonprofits/" + linkedName + "'>" + data.wikiList[i].name + "</a></li>");
|
||||
docfrag.appendChild(li);
|
||||
};
|
||||
$('#nonprofitsList').append(docfrag);
|
||||
});
|
@ -1,11 +1,11 @@
|
||||
h3
|
||||
ol#bonfireList
|
||||
ol#wikiList
|
||||
script(src='/js/lib/ramda/ramda.min.js')
|
||||
script.
|
||||
var getLinkedName = function getLinkedName(name) {
|
||||
// ensure name is a string
|
||||
name = name + '';
|
||||
return name.toLowerCase().replace(/\s/g, '-');
|
||||
return name.toLowerCase().replace(/\s/g, '-').replace(/\?/g, '');
|
||||
}
|
||||
$.ajax({
|
||||
url: '/wiki/getWikiList',
|
||||
@ -20,5 +20,5 @@ h3
|
||||
$(li).html("<a href='/wiki/" + linkedName + "'>" + data.wikiList[i].name + "</a></li>");
|
||||
docfrag.appendChild(li);
|
||||
};
|
||||
$('#bonfireList').append(docfrag);
|
||||
$('#wikiList').append(docfrag);
|
||||
});
|
||||
|
Reference in New Issue
Block a user