Skip to content
Myr

added layout control 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 f6e9fb1 · Browse files · 8 files+66 added−0 removed
This commit

State

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

Diff stats

8 files+66 added−0 removed

  • tests:+16 added−0 removed
  • other:+50 added−0 removed

8 files+66 added−0 removed

added:examples/layout-control/views/layouts/alternate.ejs+6 added
1<html>2 <body>3 <h1>Alternate Layout</h1>4 <%- body %>5 </body>6</html>
added:examples/layout-control/views/layouts/default.ejs+6 added
1<html>2 <body>3 <h1>Default Layout</h1>4 <%- body %>5 </body>6</html>
added:examples/layout-control/views/pages/alternate.ejs+2 added
1<% locals.layout = 'layouts/alternate' %>2<h1>Page</h1>
added:examples/layout-control/views/pages/default.ejs+1 added
1<h1>Page</h1>
added:examples/layout-control/app.js+35 added
added:test/fixtures/layouts/alternate.jade+1 added
1#alternate= body
added:test/fixtures/layout-switch.jade+2 added
1- locals.layout = 'layouts/alternate'2h1 My Page
modified:test/view.test.js+13 added
285 unmodified lines
286 { url: '/' },287 { body: '<cool><p>Welcome</p></cool>' });288 },289 290 'test #render() view layout control': function(){291 var app = create();292 app.set('view engine', 'jade');293 294 app.get('/', function(req, res){295 res.render('layout-switch');296 });297 298 assert.response(app,299 { url: '/' },300 { body: '<div id="alternate"><h1>My Page</h1></div>' });301 },302 303 'test #render() "view engine" with periods in dirname': function(){304 var app = create();305 app.set('view engine', 'jade');306
763 unmodified lines