apostrophe-schema-widgets
Advanced tools
Comparing version 0.5.20 to 0.5.21
32
index.js
@@ -27,8 +27,2 @@ /* jshint node:true */ | ||
self._apos.pushGlobalData({ | ||
schemaWidgets: _.map(options.widgets, function(info) { | ||
info.css = info.css || apos.cssName(info.name); | ||
return info; | ||
}) | ||
}); | ||
self._apos.pushGlobalData({ | ||
schemaWidgetsUi: { | ||
@@ -39,10 +33,6 @@ toggleUi: self.toggleUi | ||
// widgetEditors.html will spit out a frontend DOM template for editing | ||
// each widget type we register | ||
self.pushAsset('template', 'widgetEditors', { when: 'user', data: options }); | ||
self.pushAsset('script', 'editor', { when: 'user' }); | ||
self.pushAsset('stylesheet', 'editor', { when: 'user' }); | ||
_.each(options.widgets, function(options) { | ||
self.registerWidget = function(options) { | ||
var widget = {}; | ||
@@ -75,3 +65,3 @@ apos.defaultControls.push(options.name); | ||
widget.renderWidget = function(data) { | ||
widget.renderWidget = options.renderWidget || function(data) { | ||
return self.render(widget.name, data); | ||
@@ -116,5 +106,19 @@ }; | ||
self.widgets[widget.name] = widget; | ||
}); | ||
var data = { | ||
schemaWidgets: {} | ||
}; | ||
options.css = options.css || apos.cssName(options.name); | ||
data.schemaWidgets[widget.name] = options; | ||
self._apos.pushGlobalData(data); | ||
// originally designed to output templates for many widgets at once, this template | ||
// can be repurposed to push them one at a time | ||
self.pushAsset('template', 'widgetEditors', { when: 'user', data: { widgets: [ options ] } }); | ||
return setImmediate(function() { return callback && callback(null); }); | ||
}; | ||
_.each(options.widgets, self.registerWidget); | ||
if (callback) { | ||
process.nextTick(function() { return callback(null); }); | ||
} | ||
} |
{ | ||
"name": "apostrophe-schema-widgets", | ||
"version": "0.5.20", | ||
"version": "0.5.21", | ||
"description": "An easy form widget builder for the Apostrophe content management system", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
15477
205