Few jade changes to partials example

This commit is contained in:
Tj Holowaychuk 2010-12-22 15:48:41 -08:00
parent 57d87c27cd
commit a29908c865
6 changed files with 10 additions and 9 deletions

View File

@ -18,13 +18,13 @@ app.set('views', __dirname + '/views');
// (although you can still mix and match)
app.set('view engine', 'jade');
// Dummy model
// Dummy record
var ninja = {
name: 'leonardo',
summary: { email: 'hunter.loftis+github@gmail.com', master: 'splinter', description: 'peaceful leader' },
weapons: ['katana', 'fists', 'shell'],
victims: ['shredder', 'brain', 'beebop', 'rocksteady']
}
};
app.get('/', function(req, res){
res.render('ninjas/show', { ninja: ninja });

View File

@ -1 +0,0 @@
li!= victimName

View File

@ -1 +1 @@
li!= weapon
li.weapon= weapon

View File

@ -1,12 +1,13 @@
h1!= ninja.name
h1= ninja.name
// file, partial name, and partial object all match ('summary')
// the partial filename prefix '_' is completely optional
#summary!= partial('summary', ninja.summary)
// file, partial name = '_weapon', resolves to 'weapon' object within partial
#weapons
h2 Weapons
ul!= partial('_weapon', ninja.weapons)
ul!= partial('weapon', ninja.weapons)
// partial name 'victim_name' resolves to '_victim_name.jade' file and 'victimName' object
#victims

View File

@ -1,4 +1,4 @@
h2 Summary
p!= summary.email
p!= summary.description
p!= 'taught by master ' + summary.master
p= summary.email
p= summary.description
p taught by master #{summary.master}

View File

@ -0,0 +1 @@
li.victim= victimName