From fa74a1b454e99491561e3e1e4bcc7aec93869378 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Tue, 31 Mar 2015 17:38:33 -0700 Subject: [PATCH] got show all nonprofits button working and improved nonprofit show view --- app.js | 15 ++---- controllers/nonprofits.js | 13 +++-- seed_data/nonprofits.json | 48 +++++++++-------- .../how-can-free-code-camp-help-you.jade | 18 +++---- views/nonprofits/show.jade | 53 ++++++++++++++----- views/partials/nonprofits.jade | 24 ++++----- 6 files changed, 101 insertions(+), 70 deletions(-) diff --git a/app.js b/app.js index 8151112f31..b69cf246c4 100644 --- a/app.js +++ b/app.js @@ -323,9 +323,9 @@ app.post('/email-signin', userController.postSignin); * Nonprofit Project routes. */ -app.get('/nonprofits', contactController.getNonprofitsForm); - -app.post('/nonprofits', contactController.postNonprofitsForm); +//app.get('/nonprofits', contactController.getNonprofitsForm); +// +//app.post('/nonprofits', contactController.postNonprofitsForm); app.get('/nonprofits/home', nonprofitController.nonprofitsHome); @@ -351,18 +351,13 @@ app.get('/nonprofits/your-nonprofit-project-application-has-been-submitted', non app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions); +app.get('/nonprofits/getNonprofitList', nonprofitController.showAllNonprofits); + app.get( '/nonprofits/:nonprofitName', nonprofitController.returnIndividualNonprofit ); -app.get( - '/nonprofits', - 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 309ce34c60..3f13b5cd95 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -1,6 +1,6 @@ var async = require('async'), Nonprofit = require('./../models/Nonprofit'), - resources = require('./resources.json'), + resources = require('./resources'), secrets = require('./../config/secrets'), moment = require('moment'), debug = require('debug')('freecc:cntr:resources'), @@ -118,8 +118,16 @@ exports.returnIndividualNonprofit = function(req, res, next) { res.render('nonprofits/show', { title: nonprofit.name, logoUrl: nonprofit.logoUrl, + estimatedHours: nonprofit.estimatedHours, projectDescription: nonprofit.projectDescription, - approvedDeliverables: nonprofit.approvedDeliverables, + approvedOther: nonprofit.approvedDeliverables.indexOf('other') > -1, + approvedWebsite: nonprofit.approvedDeliverables.indexOf('website') > -1, + approvedDonor: nonprofit.approvedDeliverables.indexOf('donor') > -1, + approvedInventory: nonprofit.approvedDeliverables.indexOf('inventory') > -1, + approvedVolunteer: nonprofit.approvedDeliverables.indexOf('volunteer') > -1, + approvedForm: nonprofit.approvedDeliverables.indexOf('form') > -1, + approvedCommunity: nonprofit.approvedDeliverables.indexOf('community') > -1, + approvedELearning: nonprofit.approvedDeliverables.indexOf('eLearning') > -1, websiteLink: nonprofit.websiteLink, imageUrl: nonprofit.imageUrl, whatDoesNonprofitDo: nonprofit.whatDoesNonprofitDo @@ -130,6 +138,5 @@ exports.returnIndividualNonprofit = function(req, res, next) { exports.showAllNonprofits = function(req, res) { var data = {}; data.nonprofitsList = resources.allNonprofitNames(); - console.log('here I am rock you like a hurricane', data); res.send(data); }; diff --git a/seed_data/nonprofits.json b/seed_data/nonprofits.json index a4d7332cce..5c894d6217 100644 --- a/seed_data/nonprofits.json +++ b/seed_data/nonprofits.json @@ -2,11 +2,11 @@ { "id": "bd7157d8c441cbafaeb5bdef", "requestedDeliverables": [ - "Website", - "Donor Managment System", - "Inventory Management System", - "Volunteer Management System", - "Forms" + "website", + "donor", + "inventory", + "volunteer", + "form" ], "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/", @@ -15,7 +15,11 @@ "name": "Chasdei Kaduri", "endUser": "Clients, donors, and admin.", "approvedDeliverables": [ - "Website, Donor Management System, Inventory Management System, Volunteer Management System, Forms" + "website", + "donor", + "inventory", + "volunteer", + "form" ], "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", @@ -25,7 +29,7 @@ { "id": "bd7158d8c464cbafaeb4bdef", "requestedDeliverables": [ - "Other" + "other" ], "whatDoesNonprofitDo": "We connect simple technology with last mile communities to reduce poverty.", "websiteLink": "http://kopernik.info/", @@ -34,7 +38,7 @@ "name": "Kopernik", "endUser": "Women in rural Indonesia.", "approvedDeliverables": [ - "Other" + "other" ], "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", @@ -44,7 +48,7 @@ { "id": "bd6274d8c464cbafaeb4bdef", "requestedDeliverables": [ - "Other" + "other" ], "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/", @@ -53,7 +57,7 @@ "name": "No More Craptions", "endUser": "Hearing impaired users, and those who want to correct poor captions.", "approvedDeliverables": [ - "Other" + "other" ], "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", @@ -63,7 +67,7 @@ { "id": "bd1326d9c245cbafaeb4bdef", "requestedDeliverables": [ - "Website" + "website" ], "whatDoesNonprofitDo": "We distribute biodegradable toothbrushes globally to children in need.", "websiteLink": "http://www.operationbrush.org/", @@ -72,7 +76,7 @@ "name": "Operation Brush", "endUser": "Donors", "approvedDeliverables": [ - "Website" + "website" ], "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", @@ -82,7 +86,7 @@ { "id": "bd1325d8c464cbafaeb5bdef", "requestedDeliverables": [ - "Community Management Tool" + "community" ], "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/", @@ -91,7 +95,7 @@ "name": "Rose City Rollers", "endUser": "Administrators, Coaches, and Volunteers", "approvedDeliverables": [ - "Community Management Tool" + "community" ], "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", @@ -101,7 +105,7 @@ { "id": "bd1325d8c464cbafaeb6bdef", "requestedDeliverables": [ - "Website" + "website" ], "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/", @@ -110,7 +114,7 @@ "name": "Save a Child's Heart", "endUser": "Donors", "approvedDeliverables": [ - "Website" + "website" ], "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", @@ -120,7 +124,7 @@ { "id": "bd1325d8c464cbafaeb4bdef", "requestedDeliverables": [ - "Website" + "website" ], "whatDoesNonprofitDo": "Savvy Cyber Kids enables youth to be empowered with technology by providing age appropriate resources and education.", "websiteLink": "http://savvycyberkids.org/", @@ -129,7 +133,7 @@ "name": "Savvy Cyber Kids", "endUser": "Donors", "approvedDeliverables": [ - "Website" + "website" ], "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", @@ -139,7 +143,7 @@ { "id": "bd1325d8c464cbafaeb7bdef", "requestedDeliverables": [ - "Other" + "other" ], "whatDoesNonprofitDo": "Transcendent Pathways", "websiteLink": "http://transcendentpathways.org/", @@ -148,7 +152,7 @@ "name": "Transcendent Pathways", "endUser": "Medical Facilities, Musicians", "approvedDeliverables": [ - "Other" + "other" ], "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", @@ -158,7 +162,7 @@ { "id": "bd1325d8c464cbafaeb8bdef", "requestedDeliverables": [ - "Other" + "other" ], "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/", @@ -167,7 +171,7 @@ "name": "Timeraiser", "endUser": "Eventgoers", "approvedDeliverables": [ - "Other" + "other" ], "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", diff --git a/views/nonprofits/how-can-free-code-camp-help-you.jade b/views/nonprofits/how-can-free-code-camp-help-you.jade index 3aeec6490a..8c9b9678a5 100644 --- a/views/nonprofits/how-can-free-code-camp-help-you.jade +++ b/views/nonprofits/how-can-free-code-camp-help-you.jade @@ -7,27 +7,27 @@ block content .text-left.form-inline h3.col-xs-12.col-sm-offset-5.checkbox-table .col-xs-12 - input.checkbox(type='checkbox', id='websites') + input.checkbox(type='checkbox', id='website') label.ion-android-globe   Websites .col-xs-12 - input.checkbox(type='checkbox', id='donationSystems') + input.checkbox(type='checkbox', id='donation') label.ion-card   Donation Systems .col-xs-12 - input.checkbox(type='checkbox', id='volunteerSystems') + input.checkbox(type='checkbox', id='volunteer') label.ion-android-calendar   Volunteer Systems .col-xs-12 - input.checkbox(type='checkbox', id='inventorySystems') + input.checkbox(type='checkbox', id='inventory') label.ion-ios-box   Inventory Systems .col-xs-12 - input.checkbox(type='checkbox', id='eLearningPlatforms') + input.checkbox(type='checkbox', id='eLearning') label.ion-university   E-learning Platforms .col-xs-12 - input.checkbox(type='checkbox', id='webForms') + input.checkbox(type='checkbox', id='form') label.ion-ios-list   Web Forms .col-xs-12 - input.checkbox(type='checkbox', id='communityTools') + input.checkbox(type='checkbox', id='community') label.ion-ios-people   Community Tools .col-xs-12 - input.checkbox(type='checkbox', id='otherTools') + input.checkbox(type='checkbox', id='other') label.ion-settings   Other tools - button#next-step.btn.btn-primary.btn-big.btn-block(type='submit') I've selected all that apply and am ready to move on \ No newline at end of file + button#next-step.btn.btn-primary.btn-big.btn-block(type='submit') I've selected all that apply and am ready to move on diff --git a/views/nonprofits/show.jade b/views/nonprofits/show.jade index c9b5386df7..67df6efb79 100644 --- a/views/nonprofits/show.jade +++ b/views/nonprofits/show.jade @@ -7,21 +7,46 @@ block content .panel-heading.text-center h1= title .panel-body - 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 + .col-xs-12.col-sm-10.col-sm-offset-1 + .row + .col-xs-12 + img.img-center.img-responsive(src=imageUrl) + .spacer + .row + .col-xs-12.col-sm-4 + img.img-responsive(src=logoUrl) + .col-xs-12.col-sm-8 + h4= whatDoesNonprofitDo + h4 + a(href=websiteLink)= websiteLink + .col-xs-12.col-sm-10.col-sm-offset-1 + .row + h4 #{projectDescription} (About #{estimatedHours} hours per camper) + .col-xs-12.col-sm-10.col-sm-offset-1 + .row.text-center + h3 This project involves building: + if (approvedWebsite) + .ion-android-globe   Website + if (approvedDonor) + .ion-card   Donor Management System + if (approvedInventory) + .ion-ios-box   Inventory Management System + if (approvedVolunteer) + .ion-android-calendar   Volunteer Management System + if (approvedForm) + .ion-ios-list   Webform + if (approvedCommunity) + .ion-ios-people   Community Management System + if (approvedELearning) + .ion-university   E-learning Platform + if (approvedOther) + .ion-settings   Other tools + .spacer + .col-xs-12.col-sm-8.col-sm-offset-2 + .text-center + #interestedInProject.btn.btn-primary.btn-big.btn-block I'm interested in building this project + #showAllButton.btn.btn-info.btn-big.btn-block Show all Nonprofits Projects .row .col-xs-12.text-center if !user diff --git a/views/partials/nonprofits.jade b/views/partials/nonprofits.jade index 480ca27df4..c7a9db255a 100644 --- a/views/partials/nonprofits.jade +++ b/views/partials/nonprofits.jade @@ -8,17 +8,17 @@ h3 return name.toLowerCase().replace(/\s/g, '-'); } $.ajax({ - url: '/nonprofits/getNonprofitsList', + url: '/nonprofits/getNonprofitList', 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("" + data.nonprofitsList[i].name + ""); - docfrag.appendChild(li); - }; - $('#nonprofitsList').append(docfrag); - }); + .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("" + data.nonprofitsList[i].name + ""); + docfrag.appendChild(li); + }; + $('#nonprofitsList').append(docfrag); + });