Created
December 10, 2013 22:55
-
-
Save imalberto/7901909 to your computer and use it in GitHub Desktop.
res.render hack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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