Skip to content

Instantly share code, notes, and snippets.

@imalberto
Created December 10, 2013 22:55
Show Gist options
  • Select an option

  • Save imalberto/7901909 to your computer and use it in GitHub Desktop.

Select an option

Save imalberto/7901909 to your computer and use it in GitHub Desktop.
res.render hack
function _render(name, data) {
var ViewClass = Y.Views[Y.PNUtil.classify(name + '-view')] || Y.BaseView,
foo = new ViewClass({
locals: data
});
foo.render();
_expressRender(req.app.set('hack-layout'), {
viewName: name,
// TODO this belong to the render engine
viewOutlet: function () {
return '<div class="' + this.viewName + '-view">' + this.outlet + '</div>';
},
outlet: foo.get('output')
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment