UNPKG

generator-cloudcms

Version:

A generator for bootstrapping a new Cloud CMS project for a client engagement.

65 lines (52 loc) 1.77 kB
(function($) { var Alpaca = $.alpaca; if (!Alpaca.Fields) { Alpaca.Fields = {}; } Alpaca.Fields.DvorNodePickerField = Alpaca.Fields.AbstractGitanaPickerField.extend( /** * @lends Alpaca.Fields.DvorPickerField.prototype */ { launchModal: function(field, el, callback) { var self = this; // subCategory field on dvor:asset template if (self.name == "subCategory" && self.options.picker) { var id = self.top().getControlByPath('category') ? self.top().getControlByPath('category').getValue() : null; if (id) { // var ids = []; // id.forEach(element => { // ids.push(element.id); // }); self.options.picker.query = { _type: "dvor:subcategory", "parentCategory.id": { "$in": [id.id] } }; } } self.base(field, el, callback); }, getFieldType: function() { return "dvor-node-picker"; }, pickerConfiguration: function() { return { "title": "Select a Node", "type": "gitana-node-picker" }; }, getTitle: function() { return "DVOR Node Picker Field"; }, getDescription: function() { return "Field for selecting nodes from DVOR content model"; } }); Alpaca.registerFieldClass("dvor-node-picker", Alpaca.Fields.DvorNodePickerField); })(jQuery);