Update contact page to work with express-flash

This commit is contained in:
Sahat Yalkabov
2014-01-28 17:44:25 -05:00
parent 45d0c35f9d
commit 666a70a50e
2 changed files with 2 additions and 12 deletions

View File

@ -8,9 +8,7 @@ var sendgrid = require('sendgrid')(secrets.sendgrid.user, secrets.sendgrid.pass
exports.getContact = function(req, res) {
res.render('contact', {
title: 'Contact',
success: req.flash('success'),
errors: req.flash('errors')
title: 'Contact'
});
};
@ -53,7 +51,7 @@ exports.postContact = function(req, res) {
req.flash('errors', { msg: err.message });
return res.redirect('/contact');
}
req.flash('success', 'Email has been sent successfully!');
req.flash('success', { msg: 'Email has been sent successfully!' });
res.redirect('/contact');
});
};

View File

@ -1,14 +1,6 @@
extends layout
block content
if errors.length
.alert.alert-danger.animated.fadeIn
for error in errors
div= error.msg
if success.length
.alert.alert-success.animated.fadeIn
p= success
.page-header
h3 Contact Form