Skip to content
Myr

Added flash messages to blog example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent e7c442d · Browse files · 7 files+66 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+66 added−7 removed

  • other:+66 added−7 removed

7 files+66 added−7 removed

modified:examples/blog/models/post.js+11 added
modified:examples/blog/public/style.css+18 added
modified:examples/blog/routes/post.js+21 added-6 removed
modified:examples/blog/views/post/form.jade+2 added
2 unmodified lines
3 h1 Editing #{post.title}4- else5 h1 New Post67!= messages()89form#post(action='/post' + (post.title ? '/' + post.id : ''), method='post')10 - if (post.title)11 input(type='hidden', name='_method', value='put')12 p
8 unmodified lines
modified:examples/blog/views/post/index.jade+3 added
2 unmodified lines
3 h24 = post.title5 a.edit(href='/post/' + post.id + '/edit') Edit6 7 // flash messages8 != messages()9 10 // dates11 p.date.created Created at #{post.createdAt}12 - if (post.updatedAt)13 p.date.updated Updated at #{post.updatedAt}
3 unmodified lines
modified:examples/blog/views/index.jade+2 added
1h1 Blog23!= messages()45- if (count)6 p Display all #{count} post(s)7 #posts!= partial('post', posts)8- else
11 unmodified lines
modified:examples/blog/app.js+9 added-1 removed
4 unmodified lines
5/**6 * Module dependencies.7 */89var express = require('../../lib/express');9var express = require('../../lib/express')10 , messages = require('express-contrib/messages');1112app = express.createServer();1314// Config1516app.set('views', __dirname + '/views');17app.set('view engine', 'jade');1819// Flash message helper provided by express-contrib20// $ npm install express-contrib2122app.dynamicHelpers({ messages: messages });2324// Middleware2526app.configure(function(){27 app.use(express.logger('\x1b[33m:method\x1b[0m \x1b[32m:url\x1b[0m :response-time'));28 app.use(express.bodyDecoder());29 app.use(express.methodOverride());30 app.use(express.cookieDecoder());31 app.use(express.session());32 app.use(app.router);33 app.use(express.staticProvider(__dirname + '/public'));34 app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));35});
8 unmodified lines