ampersand-multifield-view
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -27,8 +27,2 @@ 'use strict'; | ||
props: { | ||
fields: { | ||
type: 'array', | ||
required: true, | ||
allowNull: false, | ||
}, | ||
label: ['string', true, ''], | ||
@@ -43,11 +37,7 @@ name: 'string' | ||
if (!this.fields) { | ||
throw new Error('must have an array of fields'); | ||
} | ||
this.value = spec.value || {}; | ||
this.beforeSubmit = spec.beforeSubmit || this.beforeSubmit; | ||
this.fields = spec.fields || this.fields || []; | ||
this.name = spec.name; | ||
this.validCallback = spec.validCallback || function() {}; | ||
this.beforeSubmit = spec.beforeSubmit || this.beforeSubmit; | ||
this.updateValid(); | ||
this.value = spec.value || {}; | ||
@@ -57,2 +47,4 @@ this.fields.forEach(function(field) { | ||
}, this); | ||
this.updateValid(); | ||
}, | ||
@@ -59,0 +51,0 @@ |
{ | ||
"name": "ampersand-multifield-view", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A view module for intelligently grouping multiple field views. Works well with ampersand-form-view", | ||
@@ -5,0 +5,0 @@ "main": "ampersand-multifield-view.js", |
# ampersand-multifield-view | ||
[![build status][travis-image]][travis-url] | ||
## purpose | ||
@@ -111,2 +113,3 @@ A view module for intelligently applying an hierarchy to form data. `MultifieldView` gathers field views into a collection that can be treated as a single field view whose value is an object with keys and values corresponding to its sub-views' names and values. Works well with [ampersand-form-view][ampersand-form-view]. | ||
- `label`: the label for the views. | ||
- `fields`: an array of form-vield views | ||
- `value`: initial value to pass on to the MultiFieldView's forms. An object where the keys match the fields' `name` attributes. | ||
@@ -157,1 +160,3 @@ - `template`: a custom template to use. | ||
[ampersand-state]: http://ampersandjs.com/docs#ampersand-state | ||
[travis-image]: https://travis-ci.org/yola/ampersand-multifield-view.svg?branch=0.1.0 | ||
[travis-url]: https://travis-ci.org/yola/ampersand-multifield-view |
13224
9
161
190