Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apostrophe-schemas

Package Overview
Dependencies
Maintainers
10
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apostrophe-schemas - npm Package Compare versions

Comparing version 0.5.22 to 0.5.23

views/checkboxes.html

34

index.js

@@ -237,2 +237,16 @@ var async = require('async');

},
checkboxes: function(req, data, name, object, field, callback) {
data[name] = self._apos.sanitizeString(data[name]).split(',');
if (!typeof(data[name]) == 'array') {
object[name] = [];
return setImmediate(callback);
}
object[name] = _.filter(data[name], function(choice) {
return _.contains(_.pluck(field.choices, 'value'), choice);
});
return setImmediate(callback);
},
select: function(req, data, name, snippet, field, callback) {

@@ -353,3 +367,2 @@ snippet[name] = self._apos.sanitizeSelect(data[name], field.choices, field.def);

} else if (attr.type === 'select') {
validatedRelationship[attr.name] = self._apos.sanitizeSelect(e[attr.name], attr.choices);

@@ -362,3 +375,3 @@ } else {

});
return setImmediate(callback);
return setImmediate(callback)
};

@@ -376,2 +389,15 @@

self.converters.form.checkboxes = function(req, data, name, object, field, callback) {
if (!typeof(data[name]) == 'array') {
object[name] = [];
return setImmediate(callback);
}
object[name] = _.filter(data[name], function(choice) {
return _.contains(_.pluck(field.choices, 'value'), choice);
});
return setImmediate(callback);
};
// END CONVERTERS

@@ -395,2 +421,6 @@

},
checkboxes: function(value, field, texts) {
var silent = (field.silent === undefined) ? true : field.silent;
texts.push({ weight: field.weight || 15, text: (value || []).join(' '), silent: silent });
},
select: function(value, field, texts) {

@@ -397,0 +427,0 @@ var silent = (field.silent === undefined) ? true : field.silent;

2

package.json
{
"version": "0.5.22",
"version": "0.5.23",
"name": "apostrophe-schemas",

@@ -4,0 +4,0 @@ "description": "Schemas for easy editing of properties in Apostrophe objects",

@@ -301,2 +301,17 @@ function AposSchemas() {

},
checkboxes: function(data, name, $field, $el, field, callback) {
var values = [];
for (var c in field.choices) {
var val = field.choices[c].value;
var checked = $field.filter('[value="'+val+'"]').prop('checked');
if (checked) {
values.push(val);
}
}
data[name] = values;
if (field.required && !data[name]) {
return apos.afterYield(_.partial(callback, 'required'));
}
return apos.afterYield(callback);
},
select: function(data, name, $field, $el, field, callback) {

@@ -446,2 +461,8 @@ data[name] = $field.val();

},
checkboxes: function(data, name, $field, $el, field, callback) {
for(var c in data[name]) {
$el.find('input[name="'+name+'"][value="'+data[name][c]+'"]').prop('checked', true);
}
return apos.afterYield(callback);
},
select: function(data, name, $field, $el, field, callback) {

@@ -448,0 +469,0 @@ var $options = $field.find('option');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc