Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed up index view path alternative

previously was doing ../index, which was not intended
now doing ../VIEW/index
  • Loading branch information...
commit 220d88d6543ae3b94a6f44d3df37973764920e3a 1 parent a254e64
@tj tj authored
Showing with 5 additions and 3 deletions.
  1. +2 −1  lib/view.js
  2. +3 −2 lib/view/view.js
View
3  lib/view.js
@@ -272,7 +272,8 @@ res.render = function(view, opts, fn, parent, sub){
// Try index ex: ./views/user/index.jade
if (!view.exists) view = new View(orig.indexPath, options);
- // Try ../name ../user from within ./user
+ // Try ../<name>/index ex: ../user/index.jade
+ // when calling partial('user') within the same dir
if (!view.exists && !options.isLayout) view = new View(orig.upIndexPath, options);
// Try layout relative to the "views" dir
View
5 lib/view/view.js
@@ -47,6 +47,7 @@ var View = exports = module.exports = function View(view, options) {
this.basename = basename(view);
this.engine = this.resolveEngine();
this.extension = '.' + this.engine;
+ this.name = this.basename.replace(this.extension, '');
this.path = this.resolvePath();
this.dirname = dirname(this.path);
};
@@ -160,14 +161,14 @@ View.prototype.__defineGetter__('indexPath', function(){
});
/**
- * Return ../index path alternative.
+ * Return ../<name>/index path alternative.
*
* @return {String}
* @api public
*/
View.prototype.__defineGetter__('upIndexPath', function(){
- return this.dirname + '/index' + this.extension;
+ return this.dirname + '/../' + this.name + '/index' + this.extension;
});
/**
Please sign in to comment.
Something went wrong with that request. Please try again.