diff --git a/app.js b/app.js index b69cf246c4..ebfd208cfe 100644 --- a/app.js +++ b/app.js @@ -353,6 +353,8 @@ app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions); app.get('/nonprofits/getNonprofitList', nonprofitController.showAllNonprofits); +app.get('/nonprofits/interested-in-nonprofit/:nonprofitName', nonprofitController.interestedInNonprofit); + app.get( '/nonprofits/:nonprofitName', nonprofitController.returnIndividualNonprofit diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js index 3f13b5cd95..69adb54c26 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -116,6 +116,7 @@ exports.returnIndividualNonprofit = function(req, res, next) { return res.redirect('../nonprofit/' + dashedNameFull); } res.render('nonprofits/show', { + dashedName: dashedNameFull, title: nonprofit.name, logoUrl: nonprofit.logoUrl, estimatedHours: nonprofit.estimatedHours, @@ -130,7 +131,8 @@ exports.returnIndividualNonprofit = function(req, res, next) { approvedELearning: nonprofit.approvedDeliverables.indexOf('eLearning') > -1, websiteLink: nonprofit.websiteLink, imageUrl: nonprofit.imageUrl, - whatDoesNonprofitDo: nonprofit.whatDoesNonprofitDo + whatDoesNonprofitDo: nonprofit.whatDoesNonprofitDo, + interestedCampers: nonprofit.interestedCampers }); }); }; @@ -140,3 +142,15 @@ exports.showAllNonprofits = function(req, res) { data.nonprofitsList = resources.allNonprofitNames(); res.send(data); }; + +exports.interestedInNonprofit = function(req, res) { + + if (req.user.uncompletedBonfires !== [] && req.user.uncompletedCoursewares !== []) { + Nonprofit.find({name: req.params.nonprofitName.replace(/-/, ' ')}, function(err, nonprofit) { + if (err) { return next(err); } + nonprofit.interestedCampers.push({"name": req.user.username, "picture": req.user.picture, "timeOfInterest": Date.now()}); + req.flash('success', { msg: 'Thanks for expressing interest in this nonprofit project!' }); + }); + } + res.redirect('back'); +}; diff --git a/models/Nonprofit.js b/models/Nonprofit.js index b1f09c340c..4a1c76e574 100644 --- a/models/Nonprofit.js +++ b/models/Nonprofit.js @@ -19,7 +19,9 @@ var nonprofitSchema = new mongoose.Schema({ projectDescription: String, logoUrl: String, imageUrl: String, - estimatedHours: String + estimatedHours: String, + interestedCampers: [], + confirmedCampers: [] }); module.exports = mongoose.model('Nonprofit', nonprofitSchema); diff --git a/models/NonprofitInterest.js b/models/NonprofitInterest.js new file mode 100644 index 0000000000..44a3fd9b6d --- /dev/null +++ b/models/NonprofitInterest.js @@ -0,0 +1,16 @@ +var mongoose = require('mongoose'); +var secrets = require('../config/secrets'); + +var nonprofitInterestSchema = new mongoose.Schema({ + nonprofitId: + name: { + type: String, + unique: false + }, + description: { + type: Array, + unique: false + } +}); + +module.exports = mongoose.model('Wiki', wikiSchema); diff --git a/public/css/main.less b/public/css/main.less index 4ed3704882..5649f43ca4 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -888,6 +888,12 @@ iframe.iphone { margin-left: 10px; } +.interested-camper-image { + height: 50px; + width: 50px; + padding: 5px; +} + //uncomment this to see the dimensions of all elements outlined in red //* { // border-color: red; diff --git a/views/nonprofits/show.jade b/views/nonprofits/show.jade index 67df6efb79..4491541b10 100644 --- a/views/nonprofits/show.jade +++ b/views/nonprofits/show.jade @@ -7,45 +7,52 @@ block content .panel-heading.text-center h1= title .panel-body - .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 - + .row + .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 + .col-xs-12 + h4= whatDoesNonprofitDo + h4 + a(href=websiteLink)= websiteLink + h3 Project Description: + .col-xs-12 + h4 #{projectDescription} (About #{estimatedHours} hours per camper) + h3 This project involves building: + .col-xs-12 + 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.text-center + h3 Interested campers: + for interestedCamper in interestedCampers + a(href='/' + interestedCamper.username class="interested-camper-image") + img.profile-picture.float-right(src=interestedUser.profile.picture) + .col-xs-12.text-center + h3 Assigned campers: .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 + a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/interested-in-nonprofit/#{dashedName}') 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