Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix for issue546 (jslint errors) - developer/guid/adding_view_engines

  • Loading branch information...
commit d466d17e1d5e6cfa1cdd4f502782f2315aa9c53f 1 parent c617fbe
@dmitris authored
View
52 examples/developer-guide/adding_view_engines/addons/view-engines/ejs.server.js
@@ -1,33 +1,35 @@
-YUI.add('addons-viewengine-ejs', function(Y, NAME) {
+/*jslint anon:true, sloppy:true, nomen:true, node:true, stupid: true */
- var ejs = require('ejs'),
- fs = require('fs');
- function EjsAdapter(viewId) {
- this.viewId = viewId;
- }
- EjsAdapter.prototype = {
+YUI.add('addons-viewengine-ejs', function(Y, NAME) {
- render: function(data, mojitType, tmpl, adapter, meta, more) {
- var me = this,
- handleRender = function(output) {
+ var ejs = require('ejs'),
+ fs = require('fs');
+ function EjsAdapter(viewId) {
+ this.viewId = viewId;
+ }
+ EjsAdapter.prototype = {
+ render: function(data, mojitType, tmpl, adapter, meta, more) {
+ var me, handleRender, result;
+ me = this;
+ handleRender = function(output) {
output.addListener('data', function(c) {
- adapter.flush(c, meta);
+ adapter.flush(c, meta);
});
output.addListener('end', function() {
- if (!more) {
- adapter.done('', meta);
- }
+ if (!more) {
+ adapter.done('', meta);
+ }
});
- };
- Y.log('Rendering template "' + tmpl + '"', 'mojito', NAME);
- var result = ejs.render(this.compiler(tmpl),data);
- console.log(result);
- adapter.done(result,meta);
- },
- compiler: function(tmpl) {
- return fs.readFileSync(tmpl, 'utf8');
- }
- };
- Y.namespace('mojito.addons.viewEngines').ejs = EjsAdapter;
+ };
+ Y.log('Rendering template "' + tmpl + '"', 'mojito', NAME);
+ result = ejs.render(this.compiler(tmpl), data);
+ console.log(result);
+ adapter.done(result, meta);
+ },
+ compiler: function(tmpl) {
+ return fs.readFileSync(tmpl, 'utf8');
+ }
+ };
+ Y.namespace('mojito.addons.viewEngines').ejs = EjsAdapter;
}, '0.1.0', {requires: []});
View
50 examples/developer-guide/adding_view_engines/mojits/myMojit/controller.server.js
@@ -1,28 +1,30 @@
+/*jslint anon:true, sloppy:true, nomen:true, node:true */
+
YUI.add('myMojit', function(Y, NAME) {
- Y.mojito.controllers[NAME] = {
+ Y.mojito.controllers[NAME] = {
- init: function(config) {
- this.config = config;
- },
- default_ve: function(ac) {
- ac.done({
- "title": "Handlebars at work!",
- "view_engines": [
- {"name": "EJS"},
- {"name": "Jade"},
- {"name": "dust"},
- {"name": "underscore" }
- ],
- "ul": { "title": 'Here are some of the other available rendering engines:' },
- });
- },
- added_ve: function(ac) {
- ac.done({
- "title": "EJS at work!",
- "view_engines": [ "Jade", "Dust","underscore" ],
- "ul": { "title": 'In addition to Handlebars and EJS, you can also use these rendering engines:' }
- });
- }
- };
+ init: function(config) {
+ this.config = config;
+ },
+ default_ve: function(ac) {
+ ac.done({
+ "title": "Handlebars at work!",
+ "view_engines": [
+ {"name": "EJS"},
+ {"name": "Jade"},
+ {"name": "dust"},
+ {"name": "underscore" }
+ ],
+ "ul": { "title": 'Here are some of the other available rendering engines:' }
+ });
+ },
+ added_ve: function(ac) {
+ ac.done({
+ "title": "EJS at work!",
+ "view_engines": [ "Jade", "Dust", "underscore" ],
+ "ul": { "title": 'In addition to Handlebars and EJS, you can also use these rendering engines:' }
+ });
+ }
+ };
}, '0.0.1', {requires: ['mojito', 'myMojitModelFoo']});
Please sign in to comment.
Something went wrong with that request. Please try again.