Skip to content
Myr

Added layout(path) helper to change the layout within a view. Closes #610

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 25bddf3 · Browse files · 4 files+8 added−3 removed
This commit

State

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

Diff stats

4 files+8 added−3 removed

  • tests:+2 added−2 removed
  • other:+6 added−1 removed

4 files+8 added−3 removed

modified:examples/layout-control/views/pages/alternate.ejs+1 added-1 removed
1<% locals.layout = 'layouts/alternate' %>1<% layout('layouts/alternate') %>2<h1>Page</h1>
modified:lib/view.js+5 added
344 unmodified lines
345 view.fn = engine.compile(view.contents, options)346 if (cacheViews) cache[orig.view] = view;347 }348349 // layout helper350 options.layout = function(path){351 layout = path;352 };353354 // render355 var str = view.fn.call(options.scope, options);356357 // layout expected
35 unmodified lines
modified:test/fixtures/layouts/alternate.jade+1 added-1 removed
1#alternate= body1#alternate!= body
modified:test/fixtures/layout-switch.jade+1 added-1 removed
1- locals.layout = 'layouts/alternate'1- layout('layouts/alternate')2h1 My Page