Skip to content
Myr

View helpers are now app specific. Closes #351

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 78008d1 · Browse files · 2 files+6 added−18 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+6 added−18 removed

  • other:+6 added−18 removed

2 files+6 added−18 removed

modified:lib/express/server.js+4 added-2 removed
27 unmodified lines
28 var self = this;29 this.config = {};30 this.settings = {};31 this.redirects = {};32 this.viewHelpers = {};33 this.dynamicViewHelpers = {};34 connect.Server.call(this, middleware || []);3536 // Expose objects to each other37 this.use(function(req, res, next){
72 unmodified lines
110 * @api public111 */112113Server.prototype.helpers = function(obj){112 utils.merge(view.helpers, obj);114 utils.merge(this.viewHelpers, obj);115 return this;116};117118/**
5 unmodified lines
124 * @api public125 */126127Server.prototype.dynamicHelpers = function(obj){126 utils.merge(view.dynamicHelpers, obj);128 utils.merge(this.dynamicViewHelpers, obj);129 return this;130};131132/**
97 unmodified lines
modified:lib/express/view.js+2 added-16 removed
43 unmodified lines
44 viewCache = {};45};4647/**48 * View helpers merged with each render's locals.49 *50 * @type Object51 */5253var helpers = exports.helpers = {};5455/**56 * Dynamic view helper functions.57 * 58 * @type Object59 */6061var dynamicHelpers = exports.dynamicHelpers = {};6263/**48 * Cache view at the given `path`.49 *50 * @param {String} path51 * @return {String}
166 unmodified lines
218 }219220 // Defaults221 var self = this,222 helpers = this.app.viewHelpers,223 dynamicHelpers = this.app.dynamicViewHelpers,224 root = viewRoot(this.app),225 ext = extname(view),226 partial = options.partial,227 layout = options.layout === undefined ? true : options.layout,
94 unmodified lines