|
|
@ -26,6 +26,25 @@ router.get('/cv', function(req, res, next) {
|
|
|
|
var pubs = bibtexParse.toJSON(pubdata);
|
|
|
|
var pubs = bibtexParse.toJSON(pubdata);
|
|
|
|
var dict = items[0]
|
|
|
|
var dict = items[0]
|
|
|
|
dict.publications = pubs;
|
|
|
|
dict.publications = pubs;
|
|
|
|
|
|
|
|
db.collection('talks').aggregate(
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
{'$sort' : {'date' : -1}},
|
|
|
|
|
|
|
|
{'$group': {_id: { $substr: ['$date',0,4] }, talks: { $push: "$$ROOT" }}},
|
|
|
|
|
|
|
|
{'$sort' : {'_id' : -1}}]).toArray(function (err, talks) {
|
|
|
|
|
|
|
|
dict.talks = talks;
|
|
|
|
|
|
|
|
res.render('cv.template', {resume: dict, css: css});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* GET works_list. */
|
|
|
|
|
|
|
|
router.get('/works_list', function(req, res, next) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var css = fs.readFileSync( path.join(__dirname, '../public/stylesheets/resume_style.css'), 'utf8');
|
|
|
|
|
|
|
|
var db = req.db;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.collection('resume').find().toArray(function (err, items) {
|
|
|
|
|
|
|
|
var dict = items[0];
|
|
|
|
|
|
|
|
|
|
|
|
db.collection('works').find({}, function(err, works) {
|
|
|
|
db.collection('works').find({}, function(err, works) {
|
|
|
|
|
|
|
|
|
|
|
@ -81,19 +100,10 @@ router.get('/cv', function(req, res, next) {
|
|
|
|
{'$sort' : {'date' : -1}},
|
|
|
|
{'$sort' : {'date' : -1}},
|
|
|
|
{'$group': {_id: { $year: "$date" }, works: { $push: "$$ROOT" }}},
|
|
|
|
{'$group': {_id: { $year: "$date" }, works: { $push: "$$ROOT" }}},
|
|
|
|
{'$sort' : {'_id' : -1}}]).toArray(function (err, worksCV) {
|
|
|
|
{'$sort' : {'_id' : -1}}]).toArray(function (err, worksCV) {
|
|
|
|
db.collection('talks').aggregate(
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
{'$sort' : {'date' : -1}},
|
|
|
|
|
|
|
|
{'$group': {_id: { $substr: ['$date',0,4] }, talks: { $push: "$$ROOT" }}},
|
|
|
|
|
|
|
|
{'$sort' : {'_id' : -1}}]).toArray(function (err, talks) {
|
|
|
|
|
|
|
|
dict.works = worksCV;
|
|
|
|
dict.works = worksCV;
|
|
|
|
dict.talks = talks;
|
|
|
|
res.render('workslist.template', {resume: dict, css: css});
|
|
|
|
console.log('talks: ' + talks);
|
|
|
|
|
|
|
|
console.log('works: ' + worksCV);
|
|
|
|
|
|
|
|
res.render('cv.template', {resume: dict, css: css});
|
|
|
|
|
|
|
|
db.collection('works').update({}, {$unset: {'events':1}}, {multi: true});
|
|
|
|
db.collection('works').update({}, {$unset: {'events':1}}, {multi: true});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return; // All done!
|
|
|
|
return; // All done!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -145,10 +155,10 @@ router.get('/cv', function(req, res, next) {
|
|
|
|
works.next(processWork);
|
|
|
|
works.next(processWork);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//handle code releases
|
|
|
|
//handle code releases
|
|
|
|
router.get('/code_releases/*.zip', function(req, res) {
|
|
|
|
router.get('/code_releases/*.zip', function(req, res) {
|
|
|
|
var db = req.db;
|
|
|
|
var db = req.db;
|
|
|
|
var splitreq = req.url.split('/');
|
|
|
|
var splitreq = req.url.split('/');
|
|
|
|
var filename = splitreq.pop();
|
|
|
|
var filename = splitreq.pop();
|
|
|
@ -161,16 +171,16 @@ router.get('/cv', function(req, res, next) {
|
|
|
|
console.log(file.redirect);
|
|
|
|
console.log(file.redirect);
|
|
|
|
res.redirect(file.redirect);
|
|
|
|
res.redirect(file.redirect);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/* redirect catch */
|
|
|
|
/* redirect catch */
|
|
|
|
router.get('/redirect=*', function(req, res, next) {
|
|
|
|
router.get('/redirect=*', function(req, res, next) {
|
|
|
|
var link = req.url.split('=').pop();
|
|
|
|
var link = req.url.split('=').pop();
|
|
|
|
request(link).pipe(res);
|
|
|
|
request(link).pipe(res);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
router.get('/*/*', function(req, res) {
|
|
|
|
router.get('/*/*', function(req, res) {
|
|
|
|
var db = req.db;
|
|
|
|
var db = req.db;
|
|
|
|
var splitreq = req.url.split('/');
|
|
|
|
var splitreq = req.url.split('/');
|
|
|
|
var filename = splitreq.pop();
|
|
|
|
var filename = splitreq.pop();
|
|
|
@ -195,77 +205,77 @@ router.get('/cv', function(req, res, next) {
|
|
|
|
console.log('done!');
|
|
|
|
console.log('done!');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
router.get('/album_art/*', function(req, res) {
|
|
|
|
router.get('/album_art/*', function(req, res) {
|
|
|
|
res.render('file');
|
|
|
|
res.render('file');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
router.get('/pubs/*', function(req, res) {
|
|
|
|
router.get('/pubs/*', function(req, res) {
|
|
|
|
res.render('file');
|
|
|
|
res.render('file');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//legacy file handler
|
|
|
|
//legacy file handler
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
router.get('/*.*', function(req, res) {
|
|
|
|
router.get('/*.*', function(req, res) {
|
|
|
|
var file = req.url.split('/').pop()
|
|
|
|
var file = req.url.split('/').pop()
|
|
|
|
request("http://legacy.unboundedpress.org/"+file).pipe(res);
|
|
|
|
request("http://legacy.unboundedpress.org/"+file).pipe(res);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* catch all*/
|
|
|
|
/* catch all*/
|
|
|
|
router.get('/*', function(req, res, next) {
|
|
|
|
router.get('/*', function(req, res, next) {
|
|
|
|
res.render('index', { title: 'Michael Winter' });
|
|
|
|
res.render('index', { title: 'Michael Winter' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper("prettifyDayDate", function(resumeDate) {
|
|
|
|
Handlebars.registerHelper("prettifyDayDate", function(resumeDate) {
|
|
|
|
if (!resumeDate) {
|
|
|
|
if (!resumeDate) {
|
|
|
|
return 'present';
|
|
|
|
return 'present';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var newDate = Moment(resumeDate).format('MM.DD.YYYY');
|
|
|
|
var newDate = Moment(resumeDate).format('MM.DD.YYYY');
|
|
|
|
//console.log('newDate: ' + newDate);
|
|
|
|
//console.log('newDate: ' + newDate);
|
|
|
|
return newDate;
|
|
|
|
return newDate;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper("prettifyMonthDate", function(resumeDate) {
|
|
|
|
Handlebars.registerHelper("prettifyMonthDate", function(resumeDate) {
|
|
|
|
if (!resumeDate) {
|
|
|
|
if (!resumeDate) {
|
|
|
|
return 'present';
|
|
|
|
return 'present';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var newDate = Moment(resumeDate).format('MMM YYYY');
|
|
|
|
var newDate = Moment(resumeDate).format('MMM YYYY');
|
|
|
|
//console.log('newDate: ' + newDate);
|
|
|
|
//console.log('newDate: ' + newDate);
|
|
|
|
return newDate;
|
|
|
|
return newDate;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper("prettifyYearDate", function(resumeDate) {
|
|
|
|
Handlebars.registerHelper("prettifyYearDate", function(resumeDate) {
|
|
|
|
if (!resumeDate) {
|
|
|
|
if (!resumeDate) {
|
|
|
|
return 'present';
|
|
|
|
return 'present';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var newDate = Moment(resumeDate).format('YYYY');
|
|
|
|
var newDate = Moment(resumeDate).format('YYYY');
|
|
|
|
//console.log('newDate: ' + newDate);
|
|
|
|
//console.log('newDate: ' + newDate);
|
|
|
|
return newDate;
|
|
|
|
return newDate;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper('toLowerCase', function(str) {
|
|
|
|
Handlebars.registerHelper('toLowerCase', function(str) {
|
|
|
|
return str.toLowerCase();
|
|
|
|
return str.toLowerCase();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper('toArray', function(val) {
|
|
|
|
Handlebars.registerHelper('toArray', function(val) {
|
|
|
|
if (typeof val === 'string') {
|
|
|
|
if (typeof val === 'string') {
|
|
|
|
return [val]
|
|
|
|
return [val]
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return val
|
|
|
|
return val
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper('unless_blank', function(item, block) {
|
|
|
|
Handlebars.registerHelper('unless_blank', function(item, block) {
|
|
|
|
return (item && item.replace(/\s/g,"").length) ? block.fn(this) : block.inverse(this);
|
|
|
|
return (item && item.replace(/\s/g,"").length) ? block.fn(this) : block.inverse(this);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Handlebars.registerHelper('equal', function(lvalue, rvalue, options) {
|
|
|
|
Handlebars.registerHelper('equal', function(lvalue, rvalue, options) {
|
|
|
|
if (arguments.length < 3)
|
|
|
|
if (arguments.length < 3)
|
|
|
|
throw new Error("Handlebars Helper equal needs 2 parameters");
|
|
|
|
throw new Error("Handlebars Helper equal needs 2 parameters");
|
|
|
|
if( lvalue!=rvalue ) {
|
|
|
|
if( lvalue!=rvalue ) {
|
|
|
@ -273,6 +283,6 @@ router.get('/cv', function(req, res, next) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return options.fn(this);
|
|
|
|
return options.fn(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = router;
|
|
|
|
module.exports = router;
|
|
|
|