Skip to content
Myr

Added; partial lookup relative to view root. Closes #447

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

for example when nested deep, if you have a partial located at ./views/messages.jade partial("messages"); will still work

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 7fdf587 · Browse files · 2 files+4 added−4 removed
This commit

State

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

Diff stats

2 files+4 added−4 removed

  • tests:+1 added−1 removed
  • other:+3 added−3 removed

2 files+4 added−4 removed

modified:lib/view.js+3 added-3 removed
283 unmodified lines
284285 // Populate view286 var orig = view = new View(view, options);287288 // Try _ prefix ex: ./views/_user.jade288 // Try _ prefix ex: ./views/_<name>.jade289 if (!view.exists) view = new View(orig.prefixPath, options);290 291 // Try index ex: ./views/user/index.jade292 if (!view.exists) view = new View(orig.indexPath, options);
1 unmodified line
294 // Try ../<name>/index ex: ../user/index.jade295 // when calling partial('user') within the same dir296 if (!view.exists && !options.isLayout) view = new View(orig.upIndexPath, options);297298 // Try layout relative to the "views" dir 299 if (!view.exists && options.isLayout) view = new View(orig.rootPath, options);298 // Try root ex: <root>/user.jade299 if (!view.exists) view = new View(orig.rootPath, options);300301 // Does not exist302 if (!view.exists) {303 if (app.enabled('hints')) hintAtViewPaths(orig, options);
74 unmodified lines
modified:test/view.test.js+1 added-1 removed
606 unmodified lines
607 });608609 assert.response(app,610 { url: '/root' },611 { body: '' });611 { body: '<p>Hits 15</p><p>Misses 1</p>' });612 },613 614 'test #partial() with several calls': function(){615 var app = create();
419 unmodified lines