ampersand-checkbox-view
Advanced tools
Comparing version 4.0.0 to 4.1.0
/*$AMPERSAND_VERSION*/ | ||
var View = require('ampersand-view'); | ||
var domify = require('domify'); | ||
var dom = require('ampersand-dom'); | ||
// can be overwritten by anything with: | ||
// <input>, <label> and the same `data-hook` attributes | ||
var template = [ | ||
'<label class="checkbox">', | ||
function defaultTemplate() { | ||
return [ | ||
'<label class="checkbox">', | ||
'<input type="checkbox"><span data-hook="label"></span>', | ||
'<div data-hook="message-container" class="message message-below message-error">', | ||
'<p data-hook="message-text"></p>', | ||
'<p data-hook="message-text"></p>', | ||
'</div>', | ||
'</label>' | ||
].join(''); | ||
'</label>' | ||
].join(''); | ||
} | ||
module.exports = View.extend({ | ||
template : defaultTemplate, | ||
initialize: function(opts) { | ||
@@ -34,3 +34,3 @@ if (!opts || !opts.name) throw new Error('must pass in a name'); | ||
this.autoRender = opts.autoRender; | ||
this.template = opts.template || template; | ||
if (opts.template) this.template = opts.template; | ||
this.beforeSubmit = opts.beforeSubmit || this.beforeSubmit; | ||
@@ -51,8 +51,3 @@ | ||
render: function () { | ||
// only allow this to be called once | ||
if (this.rendered) return; | ||
var newDom = domify(this.template); | ||
var parent = this.el && this.el.parentNode; | ||
if (parent) parent.replaceChild(newDom, this.el); | ||
this.el = newDom; | ||
this.renderWithTemplate(this); | ||
this.input = this.el.querySelector('input'); | ||
@@ -59,0 +54,0 @@ this.labelEl = this.el.querySelector('[data-hook~=label]'); |
{ | ||
"name": "ampersand-checkbox-view", | ||
"description": "A view module for intelligently rendering and validating checkbox input. Works well with ampersand-form-view.", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -17,4 +17,3 @@ "browserify": { | ||
"ampersand-version": "^1.0.2", | ||
"ampersand-view": "^8.0.0", | ||
"domify": "~1.3.3" | ||
"ampersand-view": "^8.0.0" | ||
}, | ||
@@ -21,0 +20,0 @@ "devDependencies": { |
@@ -95,2 +95,6 @@ # ampersand-checkbox-view | ||
- 4.1.0 | ||
- Remove `domify` and using ampersand-view `renderWithTemplate` | ||
- 4.0.0 | ||
- Bump to ampersand-view 8.x | ||
- 3.0.0 | ||
@@ -97,0 +101,0 @@ - Extend ampersand-view. Add support `autoRender`, `clear`, `reset` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3
110
0
14065
165
+ Addeddomify@1.4.2(transitive)
- Removeddomify@~1.3.3
- Removeddomify@1.3.3(transitive)