Skip to content
Myr

relative view option

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 8836104 · Browse files · 1 file+5 added−8 removed
This commit

State

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

Diff stats

1 file+5 added−8 removed

  • other:+5 added−8 removed

1 file+5 added−8 removed

modified:lib/express/view.js+5 added-8 removed
54 unmodified lines
55 options = options || {};56 // TODO: memoize basename etc57 this.view = view;58 this.root = options.root;59 this.relative = false !== options.relative;60 this.defaultEngine = options.defaultEngine;61 this.parent = options.parentView;62 this.basename = basename(view);63 this.engine = this.resolveEngine();
31 unmodified lines
95 if (!~this.basename.indexOf('.')) path += this.extension;96 // Absolute97 if ('/' == path[0]) return path;98 // Relative to parent98 if (this.parent) return this.parent.dirname + '/' + path;99 if (this.relative && this.parent) return this.parent.dirname + '/' + path;100 // Relative to root101 return this.root102 ? this.root + '/' + path103 : path;
266 unmodified lines
370 , partial = options.renderPartial371 , layout = options.layout;372373 // Layout support373 if (false !== layout) {374 if (true === layout || undefined === layout) {375 layout = 'layout';374 if (true === layout || undefined === layout) {375 layout = 'layout';376 }377 if ('/' != layout[0]) {378 layout = root + '/' + layout;379 }376 }377378 // Default execution scope to the response379 options.scope = options.scope || this.req;
56 unmodified lines
436 // Layout support437 if (layout) {438 options.layout = false;439 options.body = str;440 options.relative = false;441 self.render(layout, options, fn, view);442 } else if (partial) {443 return str;444 } else if (fn) {
5 unmodified lines