Skip to content
Myr

Merge pull request #2067 from swrh/mvc-example-ejs-to-jade

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

MVC example: EJS -> Jade.

authored by Roman Shtylman · committed by Roman Shtylman · parents 5480cb9, ce17efd · Browse files · 12 files+45 added−54 removed
This commit

State

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

Diff stats

12 files+45 added−54 removed

  • other:+45 added−54 removed

12 files+45 added−54 removed

modified:examples/mvc/controllers/pet/index.js-2 removed
deleted:examples/mvc/controllers/user/views/edit.html-12 removed
added:examples/mvc/controllers/user/views/edit.jade+12 added
1link(rel='stylesheet', href='/style.css')2h1= user.name3form(action='/user/#{user.id}', method='post')4 input(type='hidden', name='_method', value='put')5 label= 'Name: '6 input(type='text', name='user[name]', value='#{user.name}')7 input(type='submit', value='Update')89form(action='/user/#{user.id}/pet', method='post')10 label= 'Pet: '11 input(type='text', name='pet[name]', placeholder='Name')12 input(type='submit', value='Add')
deleted:examples/mvc/controllers/user/views/list.html-8 removed
added:examples/mvc/controllers/user/views/list.jade+7 added
1link(rel='stylesheet', href='/style.css')2h1 Users3p Click a user below to view their pets.4ul5 each user in users6 li7 a(href='/user/#{user.id}')= user.name
deleted:examples/mvc/controllers/user/views/show.html-21 removed
added:examples/mvc/controllers/user/views/show.jade+17 added
1link(rel='stylesheet', href='/style.css')2h1= user.name + ' '3 a(href='/user/#{user.id}/edit') edit45if (hasMessages)6 ul#messages7 each msg in messages8 li= msg910if (user.pets.length)11 p View #{user.name}'s pets:12 ul13 each pet in user.pets14 li15 a(href='/pet/#{pet.id}')= pet.name16else17 p No pets!
deleted:examples/mvc/views/404.html-3 removed
added:examples/mvc/views/404.jade+3 added
1link(rel='stylesheet', href='/style.css')2h1 404: Not Found3p Sorry we can't find #{url}
deleted:examples/mvc/views/5xx.html-3 removed
1<link rel="stylesheet" href="/style.css" />2<h1>500: Internal Server Error</h1>3<p>Looks like something blew up!</p>
added:examples/mvc/views/5xx.jade+3 added
1link(rel='stylesheet', href='/style.css')2h1 500: Internal Server Error3p Looks like something blew up!
modified:examples/mvc/index.js+3 added-5 removed
11 unmodified lines
12var app = module.exports = express();1314// settings1516// map .renderFile to ".html" files17app.engine('html', require('ejs').renderFile);16// set our default template engine to "jade"17// which prevents the need for extensions18app.set('view engine', 'jade');1919// make ".html" the default20app.set('view engine', 'html');2120// set views for error and 404 pages21app.set('views', __dirname + '/views');2223// define a custom res.message() method
76 unmodified lines