apostrophe-schemas
Advanced tools
Comparing version 0.1.3 to 0.1.4
34
index.js
@@ -143,3 +143,3 @@ var async = require('async'); | ||
var tags; | ||
tags = self._apos.sanitizeString(data.tags); | ||
tags = self._apos.sanitizeString(data[name]); | ||
tags = self._apos.tagsToArray(tags); | ||
@@ -262,3 +262,3 @@ snippet[name] = tags; | ||
self.converters.form.tags = function(data, name, snippet, field) { | ||
snippet[name] = self._apos.sanitizeTags(data.tags); | ||
snippet[name] = self._apos.sanitizeTags(data[name]); | ||
}; | ||
@@ -429,4 +429,32 @@ | ||
} | ||
var getter; | ||
if (manager._instance) { | ||
// Snippet type manager, has instance and index types, figure out | ||
// which one we are looking for | ||
if (manager._instance === join.withType) { | ||
getter = manager.get; | ||
} else { | ||
getter = manager.getIndexes; | ||
} | ||
} else { | ||
// Simple manager for a page type. If it has a getter, use it, | ||
// otherwise supply one | ||
getter = manager.get || function(req, _criteria, filters, callback) { | ||
var criteria = { | ||
$and: [ | ||
{ | ||
type: join.withType | ||
}, | ||
_criteria | ||
] | ||
}; | ||
return apos.get(req, criteria, filters, callback); | ||
}; | ||
} | ||
var options = { | ||
get: manager.get, | ||
// Support joining with both instance and index types. If the manager's | ||
// instance type matches, use .get, otherwise use .getIndexes | ||
get: getter, | ||
getOptions: { | ||
@@ -433,0 +461,0 @@ withJoins: withJoinsNext[join.name] || false, |
{ | ||
"name": "apostrophe-schemas", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Schemas for easy editing of properties in Apostrophe objects", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,2 +27,4 @@ function AposSchemas() { | ||
// This is a hack to implement async.eachSeries. TODO: think about putting | ||
// the async module in the browser | ||
return self.displayers[field.type](snippet, field.name, $field, $el, field, function() { | ||
@@ -344,3 +346,10 @@ return populateField(i + 1); | ||
} | ||
$field.selective({ limit: 1, data: selectiveData, source: aposPages.getManager(field.withType)._action + '/autocomplete' }); | ||
// For now this is still correct on the browser side, getManager | ||
// always returns undefined for an index type | ||
var manager = aposPages.getManager(field.withType); | ||
var autocomplete = '/apos-pages/autocomplete'; | ||
if (manager) { | ||
autocomplete = manager._action + '/autocomplete'; | ||
} | ||
$field.selective({ limit: 1, data: selectiveData, source: autocomplete }); | ||
return callback(); | ||
@@ -378,3 +387,10 @@ }, | ||
}); | ||
$field.selective({ preventDuplicates: true, sortable: field.sortable, extras: !!field.relationship, data: selectiveData, source: aposPages.getManager(field.withType)._action + '/autocomplete' }); | ||
// For now this is still correct on the browser side, getManager | ||
// always returns undefined for an index type | ||
var manager = aposPages.getManager(field.withType); | ||
var autocomplete = '/apos-pages/autocomplete?type=' + field.withType; | ||
if (manager) { | ||
autocomplete = manager._action + '/autocomplete'; | ||
} | ||
$field.selective({ preventDuplicates: true, sortable: field.sortable, extras: !!field.relationship, data: selectiveData, source: autocomplete }); | ||
return callback(); | ||
@@ -381,0 +397,0 @@ }, |
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
67208
852