apostrophe-forms
Advanced tools
Comparing version 0.5.2 to 0.5.3
37
index.js
@@ -15,3 +15,2 @@ /* jshint node:true */ | ||
forms.Forms = function(options, callback) { | ||
var self = this; | ||
@@ -85,11 +84,14 @@ | ||
if (item.ids && item.ids[0]) { | ||
criteria._id = item.ids[0] | ||
criteria._id = item.ids[0]; | ||
} | ||
}; | ||
self.sanitize = function(item) { | ||
// only one form per widget, always selected by id | ||
item.by = 'id'; | ||
if (item.ids && item.ids[0]) { | ||
item.ids = [ self.apos.sanitizeId(item.ids[0]) ]; | ||
} | ||
self.extendWidget = function(widget) { | ||
widget.sanitize = function(item) { | ||
// only one form per widget, always selected by id | ||
item.by = 'id'; | ||
if (item.ids && item.ids[0]) { | ||
item.ids = [ self._apos.sanitizeId(item.ids[0]) ]; | ||
} | ||
}; | ||
}; | ||
@@ -184,3 +186,3 @@ | ||
}, | ||
{ | ||
{ | ||
name: 'required', | ||
@@ -293,2 +295,5 @@ label: 'Must Check to Complete Form', | ||
} | ||
object.fieldId = self._apos.sanitizeId(item.fieldId) || self._apos.generateId(); | ||
return widget.afterConvertFields(req, object, function(e) { | ||
@@ -361,3 +366,6 @@ return callback(e, object); | ||
var value = req.body[field.label]; | ||
result[field.label] = self.sanitizeField(field, value); | ||
result[field.fieldId] = { | ||
label: field.label, | ||
value: self.sanitizeField(field, value) | ||
}; | ||
}); | ||
@@ -449,2 +457,11 @@ result.submittedAt = new Date(); | ||
//csv exporter: /apos-forms/export | ||
// require('./lib/exporter.js')(self); | ||
// self.exportPost = function(options){ | ||
// self._apos.db.collection('aposFormSubmissions', function(err, collection) { | ||
// }); | ||
// }; | ||
// busted-ass A2 0.5 bootstrap process fails if I | ||
@@ -451,0 +468,0 @@ // don't do this right here, so I'm doing my |
{ | ||
"name": "apostrophe-forms", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Allow your users to build forms on the fly on their Apostrophe sites", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,1 +47,7 @@ A form builder for the [Apostrophe CMS](http://apostrophenow.org). | ||
Subclass the module and override the `afterSubmit` method which is provided for this purpose. | ||
## Changelog | ||
0.5.3: fields now have a `fieldId` which will improve CSV export (however, not saving yet). The next minor version will be a bc break in the way content is saved in the collection. | ||
The forms widget now shows only the selected form, not all of them! |
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
27955
22
633
53
1