continue work on nonprofit show views

This commit is contained in:
Michael Q Larson
2015-04-01 22:31:08 -07:00
parent fa74a1b454
commit 1248cde97f
6 changed files with 85 additions and 38 deletions

2
app.js
View File

@ -353,6 +353,8 @@ app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions);
app.get('/nonprofits/getNonprofitList', nonprofitController.showAllNonprofits); app.get('/nonprofits/getNonprofitList', nonprofitController.showAllNonprofits);
app.get('/nonprofits/interested-in-nonprofit/:nonprofitName', nonprofitController.interestedInNonprofit);
app.get( app.get(
'/nonprofits/:nonprofitName', '/nonprofits/:nonprofitName',
nonprofitController.returnIndividualNonprofit nonprofitController.returnIndividualNonprofit

View File

@ -116,6 +116,7 @@ exports.returnIndividualNonprofit = function(req, res, next) {
return res.redirect('../nonprofit/' + dashedNameFull); return res.redirect('../nonprofit/' + dashedNameFull);
} }
res.render('nonprofits/show', { res.render('nonprofits/show', {
dashedName: dashedNameFull,
title: nonprofit.name, title: nonprofit.name,
logoUrl: nonprofit.logoUrl, logoUrl: nonprofit.logoUrl,
estimatedHours: nonprofit.estimatedHours, estimatedHours: nonprofit.estimatedHours,
@ -130,7 +131,8 @@ exports.returnIndividualNonprofit = function(req, res, next) {
approvedELearning: nonprofit.approvedDeliverables.indexOf('eLearning') > -1, approvedELearning: nonprofit.approvedDeliverables.indexOf('eLearning') > -1,
websiteLink: nonprofit.websiteLink, websiteLink: nonprofit.websiteLink,
imageUrl: nonprofit.imageUrl, 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(); data.nonprofitsList = resources.allNonprofitNames();
res.send(data); 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');
};

View File

@ -19,7 +19,9 @@ var nonprofitSchema = new mongoose.Schema({
projectDescription: String, projectDescription: String,
logoUrl: String, logoUrl: String,
imageUrl: String, imageUrl: String,
estimatedHours: String estimatedHours: String,
interestedCampers: [],
confirmedCampers: []
}); });
module.exports = mongoose.model('Nonprofit', nonprofitSchema); module.exports = mongoose.model('Nonprofit', nonprofitSchema);

View 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);

View File

@ -888,6 +888,12 @@ iframe.iphone {
margin-left: 10px; margin-left: 10px;
} }
.interested-camper-image {
height: 50px;
width: 50px;
padding: 5px;
}
//uncomment this to see the dimensions of all elements outlined in red //uncomment this to see the dimensions of all elements outlined in red
//* { //* {
// border-color: red; // border-color: red;

View File

@ -7,45 +7,52 @@ block content
.panel-heading.text-center .panel-heading.text-center
h1= title h1= title
.panel-body .panel-body
.col-xs-12.col-sm-10.col-sm-offset-1 .row
.row .col-xs-12.col-sm-10.col-sm-offset-1
.col-xs-12 .row
img.img-center.img-responsive(src=imageUrl) .col-xs-12
.spacer img.img-center.img-responsive(src=imageUrl)
.row .spacer
.col-xs-12.col-sm-4 .row
img.img-responsive(src=logoUrl) .col-xs-12.col-sm-4
.col-xs-12.col-sm-8 img.img-responsive(src=logoUrl)
h4= whatDoesNonprofitDo .col-xs-12.col-sm-8
h4 .col-xs-12
a(href=websiteLink)= websiteLink h4= whatDoesNonprofitDo
.col-xs-12.col-sm-10.col-sm-offset-1 h4
.row a(href=websiteLink)= websiteLink
h4 #{projectDescription} (About #{estimatedHours} hours per camper) h3 Project Description:
.col-xs-12.col-sm-10.col-sm-offset-1 .col-xs-12
.row.text-center h4 #{projectDescription} (About #{estimatedHours} hours per camper)
h3 This project involves building: h3 This project involves building:
if (approvedWebsite) .col-xs-12
.ion-android-globe   Website if (approvedWebsite)
if (approvedDonor) .ion-android-globe   Website
.ion-card   Donor Management System if (approvedDonor)
if (approvedInventory) .ion-card   Donor Management System
.ion-ios-box   Inventory Management System if (approvedInventory)
if (approvedVolunteer) .ion-ios-box   Inventory Management System
.ion-android-calendar   Volunteer Management System if (approvedVolunteer)
if (approvedForm) .ion-android-calendar   Volunteer Management System
.ion-ios-list   Webform if (approvedForm)
if (approvedCommunity) .ion-ios-list   Webform
.ion-ios-people   Community Management System if (approvedCommunity)
if (approvedELearning) .ion-ios-people   Community Management System
.ion-university   E-learning Platform if (approvedELearning)
if (approvedOther) .ion-university   E-learning Platform
.ion-settings   Other tools if (approvedOther)
.ion-settings   Other tools
.spacer .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 .col-xs-12.col-sm-8.col-sm-offset-2
.text-center .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 #showAllButton.btn.btn-info.btn-big.btn-block Show all Nonprofits Projects
.row .row
.col-xs-12.text-center .col-xs-12.text-center