diff --git a/app.js b/app.js index 3d6e59fcc9..8151112f31 100644 --- a/app.js +++ b/app.js @@ -361,6 +361,8 @@ app.get( nonprofitController.showAllNonprofits ); +app.get('/nonprofits/getNonprofitsList', nonprofitController.showAllNonprofits); + app.get( '/done-with-first-100-hours', passportConf.isAuthenticated, diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js index 502dd05b56..309ce34c60 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -1,4 +1,5 @@ var async = require('async'), + Nonprofit = require('./../models/Nonprofit'), resources = require('./resources.json'), secrets = require('./../config/secrets'), moment = require('moment'), @@ -116,13 +117,19 @@ exports.returnIndividualNonprofit = function(req, res, next) { } res.render('nonprofits/show', { title: nonprofit.name, - description: nonprofit.description.join('') + logoUrl: nonprofit.logoUrl, + projectDescription: nonprofit.projectDescription, + approvedDeliverables: nonprofit.approvedDeliverables, + websiteLink: nonprofit.websiteLink, + imageUrl: nonprofit.imageUrl, + whatDoesNonprofitDo: nonprofit.whatDoesNonprofitDo }); }); }; exports.showAllNonprofits = function(req, res) { var data = {}; - data.nonprofitList = resources.allNonprofitNames(); + data.nonprofitsList = resources.allNonprofitNames(); + console.log('here I am rock you like a hurricane', data); res.send(data); }; diff --git a/controllers/resources.js b/controllers/resources.js index b173c4c54d..d9dba69330 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -4,11 +4,13 @@ var async = require('async'), Bonfire = require('./../models/Bonfire'), Story = require('./../models/Story'), Wiki = require('./../models/Wiki'), + Nonprofit = require('./../models/Nonprofit'), Comment = require('./../models/Comment'), resources = require('./resources.json'), steps = resources.steps, secrets = require('./../config/secrets'), bonfires = require('../seed_data/bonfires.json'), + nonprofits = require('../seed_data/nonprofits.json'), coursewares = require('../seed_data/coursewares.json'), wikis = require('../seed_data/wikis.json'), moment = require('moment'), @@ -261,6 +263,14 @@ module.exports = { }) }, + allNonprofitNames: function() { + return nonprofits.map(function(elem) { + return { + name: elem.name + } + }) + }, + getAllCourses: function() { "use strict"; return coursewares; diff --git a/models/Nonprofit.js b/models/Nonprofit.js index 8fcd9ee973..b1f09c340c 100644 --- a/models/Nonprofit.js +++ b/models/Nonprofit.js @@ -9,11 +9,7 @@ var secrets = require('../config/secrets'); var nonprofitSchema = new mongoose.Schema({ name: String, - registeredNonprofit: true, requestedDeliverables: Array, - existingUserbase: true, - acceptJavascript: true, - agreeToTerms: true, whatDoesNonprofitDo: String, websiteLink: String, stakeholderName: String, @@ -23,8 +19,6 @@ var nonprofitSchema = new mongoose.Schema({ projectDescription: String, logoUrl: String, imageUrl: String, - interestedCampers: Array, - confirmedCampers: Array, estimatedHours: String }); diff --git a/seed_data/nonprofits.json b/seed_data/nonprofits.json index b22ffbfd1e..a4d7332cce 100644 --- a/seed_data/nonprofits.json +++ b/seed_data/nonprofits.json @@ -1,7 +1,6 @@ [ { "id": "bd7157d8c441cbafaeb5bdef", - "registeredNonprofit": true, "requestedDeliverables": [ "Website", "Donor Managment System", @@ -9,9 +8,6 @@ "Volunteer Management System", "Forms" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "We help the many less-fortunate Jewish families in our community, by providing them with nutritious food and energy to grow, learn, work, and give them hope for a better and brighter future.", "websiteLink": "http://chasdeikaduri.org/", "stakeholderName": "Jonathan Tebeka", @@ -24,19 +20,13 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "200" }, { "id": "bd7158d8c464cbafaeb4bdef", - "registeredNonprofit": true, "requestedDeliverables": [ "Other" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "We connect simple technology with last mile communities to reduce poverty.", "websiteLink": "http://kopernik.info/", "stakeholderName": "Amber Gregory", @@ -49,19 +39,13 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "100" }, { "id": "bd6274d8c464cbafaeb4bdef", - "registeredNonprofit": true, "requestedDeliverables": [ "Other" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "No More Craptions seeks to improve upon automatic captioning on YouTube videos, by allowing users to edit captions to videos, even if they do not own the content.", "websiteLink": "http://nomorecraptions.com/", "stakeholderName": "Michael Lockrey", @@ -74,19 +58,13 @@ "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": "", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "200" }, { "id": "bd1326d9c245cbafaeb4bdef", - "registeredNonprofit": true, "requestedDeliverables": [ "Website" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "We distribute biodegradable toothbrushes globally to children in need.", "websiteLink": "http://www.operationbrush.org/", "stakeholderName": "Dane Jonas", @@ -99,19 +77,13 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "100" }, { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, + "id": "bd1325d8c464cbafaeb5bdef", "requestedDeliverables": [ "Community Management Tool" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "We are the largest roller derby league in the world with around 250 adults and 150 junior skater members plus 500+ volunteers.", "websiteLink": "http://www.rosecityrollers.com/about/our-charities/", "stakeholderName": "Charity Kuahiwinui", @@ -124,19 +96,13 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "200" }, { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, + "id": "bd1325d8c464cbafaeb6bdef", "requestedDeliverables": [ "Website" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "Save a Child's Heart provides urgently needed pediatric heart surgery and follow-up care for indigent children from developing countries", "websiteLink": "http://www.saveachildsheart.com/global/young-leadership-program/", "stakeholderName": "Shier Ziser", @@ -149,19 +115,13 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "100" }, { "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, "requestedDeliverables": [ "Website" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "Savvy Cyber Kids enables youth to be empowered with technology by providing age appropriate resources and education.", "websiteLink": "http://savvycyberkids.org/", "stakeholderName": "Ben Halpert", @@ -174,20 +134,14 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "200" }, { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, + "id": "bd1325d8c464cbafaeb7bdef", "requestedDeliverables": [ "Other" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, - "whatDoesNonprofitDo": "Transcendent Pathways ", + "whatDoesNonprofitDo": "Transcendent Pathways", "websiteLink": "http://transcendentpathways.org/", "stakeholderName": "Mark Ackerley", "stakeholderEmail": "mackerley.music@gmail.com", @@ -199,19 +153,13 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "200" }, { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, + "id": "bd1325d8c464cbafaeb8bdef", "requestedDeliverables": [ "Other" ], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, "whatDoesNonprofitDo": "Timeraiser is a volunteer matching fair, a silent art auction, and a night out on the town. The big Timeraiser twist is rather than bid money on artwork, participants bid volunteer hours. ", "websiteLink": "http://www.timeraiser.ca/", "stakeholderName": "Stephanie McAllister", @@ -224,71 +172,6 @@ "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", - "interestedCampers": [], - "confirmedCampers": [], "estimatedHours": "100" - }, - { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, - "requestedDeliverables": [], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, - "whatDoesNonprofitDo": "string", - "websiteLink": "string", - "stakeholderName": "string", - "stakeholderEmail": "string", - "name": "string", - "endUser": "string", - "approvedDeliverables": [], - "projectDescription": "string", - "logoUrl": "string", - "imageUrl": "string", - "interestedCampers": [], - "confirmedCampers": [], - "estimatedHours": "string" - }, - { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, - "requestedDeliverables": [], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, - "whatDoesNonprofitDo": "string", - "websiteLink": "string", - "stakeholderName": "string", - "stakeholderEmail": "string", - "name": "string", - "endUser": "string", - "approvedDeliverables": [], - "projectDescription": "string", - "logoUrl": "string", - "imageUrl": "string", - "interestedCampers": [], - "confirmedCampers": [], - "estimatedHours": "string" - }, - { - "id": "bd1325d8c464cbafaeb4bdef", - "registeredNonprofit": true, - "requestedDeliverables": [], - "existingUserbase": true, - "acceptJavascript": true, - "agreeToTerms": true, - "whatDoesNonprofitDo": "string", - "websiteLink": "string", - "stakeholderName": "string", - "stakeholderEmail": "string", - "name": "string", - "endUser": "string", - "approvedDeliverables": [], - "projectDescription": "string", - "logoUrl": "string", - "imageUrl": "string", - "interestedCampers": [], - "confirmedCampers": [], - "estimatedHours": "string" } ] diff --git a/seed_data/seed.js b/seed_data/seed.js index f58fab7204..5a131cc4d9 100644 --- a/seed_data/seed.js +++ b/seed_data/seed.js @@ -2,16 +2,18 @@ require('dotenv').load(); var Bonfire = require('../models/Bonfire.js'), Courseware = require('../models/Courseware.js'), Wiki = require('../models/Wiki.js'), + Nonprofit = require('../models/Nonprofit.js'), mongoose = require('mongoose'), secrets = require('../config/secrets'), coursewares = require('./coursewares.json'), - wikis = require('./wikis.json') + wikis = require('./wikis.json'), + nonprofits = require('./nonprofits.json'), bonfires = require('./bonfires.json'); mongoose.connect(secrets.db); var counter = 0; -var offerings = 3; +var offerings = 4; var CompletionMonitor = function() { counter++; @@ -75,3 +77,20 @@ Wiki.remove({}, function(err, data) { }); console.log('wikis'); }); + +Nonprofit.remove({}, function(err, data) { + if (err) { + console.error(err); + } else { + console.log('Deleted ', data); + } + Nonprofit.create(nonprofits, function(err, data) { + if (err) { + console.log(err); + } else { + console.log('Saved ', data); + } + CompletionMonitor(); + }); + console.log('nonprofits'); +}); diff --git a/views/nonprofits/show.jade b/views/nonprofits/show.jade index d5628c415b..c9b5386df7 100644 --- a/views/nonprofits/show.jade +++ b/views/nonprofits/show.jade @@ -7,7 +7,17 @@ block content .panel-heading.text-center h1= title .panel-body - div!= description + h3= whatDoesNonprofitDo + for deliverable in approvedDeliverables + p= deliverable + p Website: + a(href=websiteLink)= websiteLink + p Project Description: + = projectDescription + p Estimated Hours Per Camper + = estimatedHours + img.img-responsive(src=imageUrl) + img.img-responsive(src=logoUrl) .spacer .text-center #showAllButton.btn.btn-info.btn-big Show all Nonprofits Projects diff --git a/views/partials/nonprofits.jade b/views/partials/nonprofits.jade index 1ffcb445c8..480ca27df4 100644 --- a/views/partials/nonprofits.jade +++ b/views/partials/nonprofits.jade @@ -8,7 +8,7 @@ h3 return name.toLowerCase().replace(/\s/g, '-'); } $.ajax({ - url: '/wiki/getNonprofitsList', + url: '/nonprofits/getNonprofitsList', type: 'GET' }) .success( @@ -17,7 +17,7 @@ h3 for (var i = 0; i < data.nonprofitsList.length; i++) { var li = document.createElement("li"); var linkedName = getLinkedName(data.nonprofitsList[i].name); - $(li).html("" + data.wikiList[i].name + ""); + $(li).html("" + data.nonprofitsList[i].name + ""); docfrag.appendChild(li); }; $('#nonprofitsList').append(docfrag);