Skip to content
Myr

Added view index resolution support

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 42ea6af · Browse files · 7 files+24 added−13 removed
This commit

State

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

Diff stats

7 files+24 added−13 removed

  • tests:+1 added−1 removed
  • other:+23 added−12 removed

7 files+24 added−13 removed

deleted:examples/jade/views/user/_user.jade-3 removed
1.user2 h2= user.name3 .email= user.email
deleted:examples/jade/views/user/list.jade-3 removed
1- if (users.length)2 h1 Users3 #users!= partial('user', users)
added:examples/jade/views/users/_user.jade+3 added
1.user2 h2= user.name3 .email= user.email
added:examples/jade/views/users/index.jade+3 added
1- if (users.length)2 h1 Users3 #users!= partial('user', users)
modified:examples/jade/app.js+1 added-1 removed
modified:lib/express/view/view.js+16 added-5 removed
21 unmodified lines
2223var cache = {};2425/**26 * Existance cache.27 */2829var exists = {};3031/**32 * Initialize a new `View` with the given `view` path and `options`.33 *34 * @param {String} view35 * @param {Object} options
22 unmodified lines
58 * @api public59 */6061View.prototype.__defineGetter__('exists', function(){62 var path = this.path;63 if (null != exists[path]) {64 return exists[path];65 } else {56 try {57 stat(this.path);58 return true;59 } catch (err) {60 return false;66 try {67 stat(path);68 return exists[path] = true;69 } catch (err) {70 return exists[path] = false;71 }72 }73});7475/**
106 unmodified lines
modified:test/view.test.js+1 added-1 removed
269 unmodified lines
270 assert.response(app,271 { url: '/nope' },272 function(res){273 assert.ok(res.body.indexOf('Error: ENOENT') >= 0);274 assert.ok(res.body.indexOf('nope.jade') >= 0);274 assert.ok(res.body.indexOf('nope/index.jade') >= 0);275 });276277 beforeExit(function(){278 assert.ok(called, 'Layout callback never called');
492 unmodified lines