From c02fafa6a95ab04fb15bc268156f82387c4a41f0 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 8 Apr 2015 14:36:05 -0700 Subject: [PATCH] add status, turn hours into integer, create a directory view of all nonprofits --- app.js | 6 ++---- controllers/nonprofits.js | 19 +++++++++++++++++-- models/Nonprofit.js | 5 +++-- seed_data/nonprofits.json | 27 ++++++++++++++++++--------- views/nonprofits/directory.jade | 19 +++++++++++++++++++ views/nonprofits/show.jade | 3 +-- 6 files changed, 60 insertions(+), 19 deletions(-) create mode 100644 views/nonprofits/directory.jade diff --git a/app.js b/app.js index 39ef393fe9..27092125a1 100644 --- a/app.js +++ b/app.js @@ -329,11 +329,9 @@ app.post('/email-signin', userController.postSignin); * Nonprofit Project routes. */ -//app.get('/nonprofits', contactController.getNonprofitsForm); -// -//app.post('/nonprofits', contactController.postNonprofitsForm); +app.get('/nonprofits', nonprofitController.nonprofitsHome); -app.get('/nonprofits/home', nonprofitController.nonprofitsHome); +app.get('/nonprofits/directory', nonprofitController.nonprofitsDirectory); app.get('/nonprofits/are-you-with-a-registered-nonprofit', nonprofitController.areYouWithARegisteredNonprofit); diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js index 91aadfc037..c6bf824905 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -12,6 +12,18 @@ exports.nonprofitsHome = function(req, res) { }); }; +exports.nonprofitsDirectory = function(req, res) { + Nonprofit.find({estimatedHours: { $gt: 0 } }, function(err, nonprofits) { + if (err) { + next(err); + } + res.render('nonprofits/directory', { + title: 'Nonprofits we help', + nonprofits: nonprofits + }); + }); +}; + exports.areYouWithARegisteredNonprofit = function(req, res) { res.render('nonprofits/are-you-with-a-registered-nonprofit', { title: 'Are you with a with a registered nonprofit', @@ -64,7 +76,7 @@ exports.linkUsToYourWebsite = function(req, res) { exports.tellUsYourEmail = function(req, res) { res.render('nonprofits/tell-us-your-email', { - title: 'Tell us your name', + title: 'Tell us your email', step: 8 }); }; @@ -77,7 +89,10 @@ exports.tellUsYourName = function(req, res) { }; exports.finishApplication = function(req, res) { - + res.render('nonprofits/you-have-finished-your-application', { + title: "You have finished your application", + step: 10 + }); }; exports.yourNonprofitProjectApplicationHasBeenSubmitted = function(req, res) { diff --git a/models/Nonprofit.js b/models/Nonprofit.js index 39f77085e0..8ea47ddea0 100644 --- a/models/Nonprofit.js +++ b/models/Nonprofit.js @@ -19,9 +19,10 @@ var nonprofitSchema = new mongoose.Schema({ projectDescription: String, logoUrl: String, imageUrl: String, - estimatedHours: String, + estimatedHours: 0, interestedCampers: [], - confirmedCampers: [] + confirmedCampers: [], + status: "evaluating" //"evaluating", "confirmed", "started", "completed", "aborted" }); module.exports = mongoose.model('Nonprofit', nonprofitSchema); diff --git a/seed_data/nonprofits.json b/seed_data/nonprofits.json index 5c894d6217..eae8f08236 100644 --- a/seed_data/nonprofits.json +++ b/seed_data/nonprofits.json @@ -24,7 +24,8 @@ "projectDescription": "Campers will create a system will integrate the food inventory, donor and delivery driver management systems as well as replace the current application system with a custom form solution. System will include a more streamlined operations management, with user printable lists of inventory, drivers, and deliveries.", "logoUrl": "https://trello-attachments.s3.amazonaws.com/54c7e02f2c173c37015b2f36/604x309/00580a0567a4b3afda29d52b09e7e829/rQQ6zwq31Uya8ie9QHC-MlvfXxqftm9UPPe524JUhmwSEaZjQ7oL7U1tVoHLUj-gVUwM-7uzBGFsAXD_A_cx_JyAZP4Td-GMBJ-AebJNRAQP0m0v253eKMkURp63aG4%3Ds0-d-e1-ft.png", "imageUrl": "http://chasdeikaduri.org/images/523455_516325865106850_1885515210_n.jpg", - "estimatedHours": "200" + "estimatedHours": 200, + "status": "started" }, { "id": "bd7158d8c464cbafaeb4bdef", @@ -43,7 +44,8 @@ "projectDescription": "Campers will create a Chrome browser extension to preserve sales data from a form, and upload in batches as the internet connection allows.", "logoUrl": "https://trello-attachments.s3.amazonaws.com/54d29f1e4c726fd765fa87ef/54d29f6388812dd367a243ab/x/018d9d3be5439870c56cccba5b3aa8bf/kopernik-logo-global.png", "imageUrl": "http://kopernik.info/sites/default/files/updates/Presenting_the_low_carbon_t.jpg", - "estimatedHours": "100" + "estimatedHours": 100, + "status": "completed" }, { "id": "bd6274d8c464cbafaeb4bdef", @@ -62,7 +64,8 @@ "projectDescription": "Campers will create a full stack JavaScript solution to allow users to edit captions from YouTube videos.", "logoUrl": "https://trello-attachments.s3.amazonaws.com/54c1da1ba1fe2e325df5fc34/54c1dd31226b8111794d132f/x/b0402135d9ecce6d4ab45c4b5e5aeaa0/Turning-online-horse-manure-into-strawberry-jam---since-2009.png", "imageUrl": "", - "estimatedHours": "200" + "estimatedHours": 200, + "status": "completed" }, { "id": "bd1326d9c245cbafaeb4bdef", @@ -81,7 +84,8 @@ "projectDescription": "Campers will create a mobile responsive website for the organization, with donation capabilities.", "logoUrl": "https://trello-attachments.s3.amazonaws.com/54d9810307b159a4d9027aa2/54d981bfe5eb145560fbb769/x/cf7f318bfe4aee631b0d0eeef272225c/logo.png", "imageUrl": "http://www.operationbrush.org/images/temp/hands1.png", - "estimatedHours": "100" + "estimatedHours": 100, + "status": "started" }, { "id": "bd1325d8c464cbafaeb5bdef", @@ -100,7 +104,8 @@ "projectDescription": "Campers will create a volunteer management system with multi-user access and reporting capabilities.", "logoUrl": "https://trello-attachments.s3.amazonaws.com/54c1daf2d72d8eb868910b60/54c1dd4ecffcb09fc52b68a1/x/a8148f08769b449217e433bab8f39ddd/RCR-color.jpg", "imageUrl": "http://www.rosecityrollers.com/wp-content/uploads/2015/01/BZ7_5923-X3-675x375.jpg", - "estimatedHours": "200" + "estimatedHours": 200, + "status": "started" }, { "id": "bd1325d8c464cbafaeb6bdef", @@ -119,7 +124,8 @@ "projectDescription": "Campers will create a single page fundraising website. In exchange for a donation, a user can customize a graphical 'heart' in someone's name or anonymously. The page will display all of the hearts on a 'wall of hearts.'", "logoUrl": "https://trello-attachments.s3.amazonaws.com/548b36629137780091a973cc/666x666/6c7a366ffb659649f6377d4a431687cd/country-logos-1-300dpi.jpg", "imageUrl": "http://www.saveachildsheart.com/wp-content/uploads/2013/10/7.2.5_Internation_Photograohy_Exhibition.jpg", - "estimatedHours": "100" + "estimatedHours": 100, + "status": "completed" }, { "id": "bd1325d8c464cbafaeb4bdef", @@ -138,7 +144,8 @@ "projectDescription": "Campers will create a website where potential donors can view which schools already have the Savvy Cyber Kids books, and donate books to those schools that do not.", "logoUrl": "https://trello-attachments.s3.amazonaws.com/54ee3c7bf205562680177b59/218x190/1dc460de4edc9fdd4b481b24e93cfb23/logo.png", "imageUrl": "http://www.privatewifi.com/wp-content/uploads/2014/10/Halpert.jpg", - "estimatedHours": "200" + "estimatedHours": 200, + "status": "started" }, { "id": "bd1325d8c464cbafaeb7bdef", @@ -157,7 +164,8 @@ "projectDescription": "Campers will build a website where medical facilities can list music therapy time slots, and musicians can sign up to fill these slots.", "logoUrl": "http://static1.squarespace.com/static/521b8957e4b024f66a58b214/t/521b8e9de4b093a8696eb9b8/1398718364447/?format=750w", "imageUrl": "https://trello-attachments.s3.amazonaws.com/54fdb0328917ca64e9e8a79f/54fdc3b710f67caf6da14719/x/49fbe0012179bf254928f3f2a44810b4/Screen_2BShot_2B2013-08-26_2Bat_2B1.32.35_2BPM.png", - "estimatedHours": "200" + "estimatedHours": 200, + "status": "started" }, { "id": "bd1325d8c464cbafaeb8bdef", @@ -176,6 +184,7 @@ "projectDescription": "Campers will build a mobile responsive web form to allow Timeraiser eventgoers to select which nonprofit organizations they're interested in volunteering with. System will have Salesforce integration and reporting capabilities.", "logoUrl": "http://www.timeraiser.ca/uploads/5/6/1/4/5614163/1277176.png?480", "imageUrl": "http://www.timeraiser.ca/uploads/5/6/1/4/5614163/______________4571248_orig.png", - "estimatedHours": "100" + "estimatedHours": 100, + "status": "started" } ] diff --git a/views/nonprofits/directory.jade b/views/nonprofits/directory.jade new file mode 100644 index 0000000000..309cad9287 --- /dev/null +++ b/views/nonprofits/directory.jade @@ -0,0 +1,19 @@ +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 Nonprofits We Help + .panel-body + for nonprofit in nonprofits + .spacer + .row + .col-xs-12.col-sm-3 + img.img-responsive(src=nonprofit.logoUrl) + .col-xs-12.col-sm-9 + h2.negative-15= nonprofit.name + h3.negative-15= nonprofit.whatDoesNonprofitDo + a.text-center.btn.btn-primary.btn-lg(href='/nonprofits/' + nonprofit.name.toLowerCase().replace(/\s/g, '-')) Read more + .spacer + .spacer diff --git a/views/nonprofits/show.jade b/views/nonprofits/show.jade index 31297684f2..8ef8fc8776 100644 --- a/views/nonprofits/show.jade +++ b/views/nonprofits/show.jade @@ -4,8 +4,7 @@ block content var challengeName = 'Nonprofits View'; .col-xs-12.col-sm-12.col-md-12 .panel.panel-info - .panel-heading.text-center - h1= title + .panel-heading.text-center= title .panel-body .row .col-xs-12.col-sm-10.col-sm-offset-1