Added partial migration docs
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 0b86ce2 · Browse files · 3 files·+93 added−1 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+93 added−1 removed
- other:+93 added−1 removed
Provenance
- Commit
2a674f4- Tree
3d66955- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
0b86ce2
3 files changed+93 added−1 removed
modified:docs/migrate.1+52 added
177 unmodified lines178 .179 .fi180 .181 .IP "" 0182+.183+.P184+Previously rendering of a collection via \fBpartial()\fR would look something like this:185+.186+.IP "" 4187+.188+.nf189 190+this\.partial(\'comment\.html\.haml\', { collection: comments });191+.192+.fi193+.194+.IP "" 0195+.196+.P197+Although this worked just fine, it was generally to verbose, the similar but new API looks like this, as \fBpartial()\fR is \fIalways\fR passed as a local variable:198+.199+.IP "" 4200+.201+.nf202+203+partial(\'comment\.haml\', { collection: comments });204+.205+.fi206+.207+.IP "" 0208+.209+.P210+To make things even less verbose we can assume the extension when ommitted:211+.212+.IP "" 4213+.214+.nf215+216+partial(\'comment\', { collection: comments });217+.218+.fi219+.220+.IP "" 0221+.222+.P223+And once again even further, when rendering a collection we can simply pass an array, if no other options are desired:224+.225+.IP "" 4226+.227+.nf228+229+partial(\'comments\', comments);230+.231+.fi232+.233+.IP "" 0234+modified:docs/migrate.html+22 added
271 unmodified lines272 });273 });274 </code></pre>275 276+<p>Previously rendering of a collection via <code>partial()</code> would look something like this:</p>277+278+<pre><code>this.partial('comment.html.haml', { collection: comments });279+</code></pre>280+281+<p>Although this worked just fine, it was generally to verbose, the similar but new API282+looks like this, as <code>partial()</code> is <em>always</em> passed as a local variable:</p>283+284+<pre><code>partial('comment.haml', { collection: comments });285+</code></pre>286+287+<p>To make things even less verbose we can assume the extension when ommitted:</p>288+289+<pre><code>partial('comment', { collection: comments });290+</code></pre>291+292+<p>And once again even further, when rendering a collection we can simply pass293+an array, if no other options are desired:</p>294+295+<pre><code>partial('comments', comments);296+</code></pre>297+298 </div>299 </div>300 </div>301 </body>1 unmodified linemodified:docs/migrate.md+19 added-1 removed
107 unmodified linesExpand all108109110111112112113114115116117118119120121122123124125126127128129130107 unmodified linesExpand all app.get('/', function(req, res){ res.render('index.haml', { locals: { title: 'My Site' } }); });No newline at end of file });
Previously rendering of a collection via `partial()` would look something like this:
this.partial('comment.html.haml', { collection: comments });
Although this worked just fine, it was generally to verbose, the similar but new APIlooks like this, as `partial()` is _always_ passed as a local variable:
partial('comment.haml', { collection: comments });
To make things even less verbose we can assume the extension when ommitted:
partial('comment', { collection: comments });
And once again even further, when rendering a collection we can simply passan array, if no other options are desired:
partial('comments', comments);