/**
* Render `view` partial with the given `options`.
*
* Options:
* - `as` Variable name for each `collection` value, defaults to the view name.
* - `as` Variable name for each `collection` value, defaults to the view name.
* When assigning `as: this`, each value in the collection will become the
* evaluation context of the template.
*
* - `collection` Array of objects, the name is derived from the view name itself.
* For example _video.html_ will have a object _video_ available to it.
*
* @param {String} view
len = collection.length;
var locals = options.locals = options.locals || {};
locals.collectionLength = len;
return collection.map(function(val, i){
if (typeof name === 'string') {
locals[name] = val;
locals[name] = val;
} else {
options.context = val;
}
locals.firstInCollection = i === 0;
locals.indexInCollection = i;
locals.lastInCollection = i === len - 1;
return this.render(view, options);
110 unmodified lines
Expand all