hmpo-template-mixins
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -109,5 +109,5 @@ 'use strict'; | ||
function checkbox(key, options) { | ||
options = options || {}; | ||
options.required = options.required || false; | ||
function checkbox(key, opts) { | ||
opts = opts || {}; | ||
opts.required = opts.required || false; | ||
var selected = false; | ||
@@ -117,6 +117,6 @@ if (this.values && this.values[key] !== undefined) { | ||
} | ||
return _.extend(options, { | ||
return _.extend(opts, { | ||
key: key, | ||
error: this.errors && this.errors[key], | ||
invalid: this.errors && this.errors[key] && options.required, | ||
invalid: this.errors && this.errors[key] && opts.required, | ||
label: t(sharedTranslationsKey + '.fields.' + key + '.label'), | ||
@@ -198,5 +198,5 @@ selected: selected | ||
res.locals['checkbox-compound'] = function () { | ||
var options = { compound: true }; | ||
var opts = { compound: true }; | ||
return function (key) { | ||
return compiled['partials/forms/checkbox'].render(checkbox.call(this, key, options)); | ||
return compiled['partials/forms/checkbox'].render(checkbox.call(this, key, opts)); | ||
}; | ||
@@ -206,5 +206,5 @@ }; | ||
res.locals['checkbox-required'] = function () { | ||
var options = { required: true }; | ||
var opts = { required: true }; | ||
return function (key) { | ||
return compiled['partials/forms/checkbox'].render(checkbox.call(this, key, options)); | ||
return compiled['partials/forms/checkbox'].render(checkbox.call(this, key, opts)); | ||
}; | ||
@@ -211,0 +211,0 @@ }; |
{ | ||
"name": "hmpo-template-mixins", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "A middleware that exposes a series of Mustache mixins on res.locals to ease usage of forms, translations, and some general needs.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "npm run lint", | ||
"lint": "./node_modules/.bin/eslint ." | ||
}, | ||
@@ -33,3 +34,6 @@ "repository": { | ||
"underscore": "^1.7.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^0.14.1" | ||
} | ||
} |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
18219
13
1
1