Skip to content
Myr

Fixed _ prefix object resolution on partials (resolveObjectName), added _ prefix fallback to view file resolution (prefixPath)

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

authored by Hunter Loftis · committed by Tj Holowaychuk · parent 5d87133 · Browse files · 3 files+21 added−2 removed
This commit

State

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

Diff stats

3 files+21 added−2 removed

  • other:+21 added−2 removed

3 files+21 added−2 removed

modified:lib/express/view/partial.js+1 added
modified:lib/express/view/view.js+11 added
146 unmodified lines
147 + '/index' + this.extension;148});149150/**151 * Return _ prefix path alternative152 *153 * @return {String}154 * @api public155 */156157View.prototype.__defineGetter__('prefixPath', function(){158 return this.dirname + '/_' + this.basename;159});160161/**162 * Register the given template engine `exports`163 * as `ext`. For example we may wish to map ".html"164 * files to jade:165 *
32 unmodified lines
modified:lib/express/view.js+9 added-2 removed
196 unmodified lines
197 view = partial198 ? new Partial(view, options)199 : new View(view, options);200201 // Ensure view exists, otherwise try index201 // Ensure view exists, otherwise try _ prefix202 if (!view.exists) {203 view = partial204 ? new Partial(view.prefixPath, options)205 : new View(view.prefixPath, options);206 }207 208 // Ensure view _ prefix exists, otherwise try index209 if (!view.exists) {210 view = partial211 ? new Partial(view.indexPath, options)212 : new View(view.indexPath, options);213 }207214 215 // Dynamic helper support216 if (false !== options.dynamicHelpers) {217 // cache218 if (!this.__dynamicHelpers) {
55 unmodified lines