mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
Few jade changes to partials example
This commit is contained in:
parent
57d87c27cd
commit
a29908c865
|
|
@ -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 });
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
li!= victimName
|
||||
|
|
@ -1 +1 @@
|
|||
li!= weapon
|
||||
li.weapon= weapon
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
1
examples/partials/views/ninjas/victim_name.jade
Normal file
1
examples/partials/views/ninjas/victim_name.jade
Normal file
|
|
@ -0,0 +1 @@
|
|||
li.victim= victimName
|
||||
Loading…
Reference in New Issue
Block a user