Skip to content
Myr

Fixed dynamic helper in flash example

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 348fa40 · Browse files · 3 files+47 added−24 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+47 added−24 removed

  • other:+47 added−24 removed

3 files+47 added−24 removed

added:examples/flash/views/partials/messages.ejs+12 added
1<% if (hasMessages) { %>2 <div id="messages">3 <% for (var type in types) { %>4 <h2><%= type %> messages</h2>5 <ul id="<%= type %>">6 <% types[type].forEach(function(msg){ %>7 <li><%= msg %></li>8 <% }) %>9 </ul>10 <% } %>11 </div>12<% } %>
modified:examples/flash/app.js+23 added-14 removed
modified:lib/express/view.js+12 added-10 removed
207 unmodified lines
208 options.locals = options.locals || {};209 options.locals.__filename = options.filename = path;210211 // Dynamic helper support212 if (options.dynamicHelpers !== false) {212 var keys = Object.keys(dynamicHelpers);213 for (var i = 0, len = keys.length; i < len; ++i) {214 var key = keys[i],215 val = dynamicHelpers[key];216 if (typeof val === 'function') {217 helpers[key] = val.call(218 this.app, 219 this.req, 220 this, 221 this.req.params.path);213 var keys = Object.keys(dynamicHelpers);214 for (var i = 0, len = keys.length; i < len; ++i) {215 var key = keys[i],216 val = dynamicHelpers[key];217 if (typeof val === 'function') {218 helpers[key] = val.call(219 this.app, 220 this.req, 221 this, 222 this.req.params.path);223 }224 }225 }226227 // Always expose partial() as a local
46 unmodified lines