continue work on nonprofit show views
This commit is contained in:
2
app.js
2
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
|
||||
|
@ -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');
|
||||
};
|
||||
|
@ -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);
|
||||
|
16
models/NonprofitInterest.js
Normal file
16
models/NonprofitInterest.js
Normal file
@ -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);
|
@ -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;
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user