Sha256: 74dd6295dc8abdee30204680d972ae74462bc44a355a000108f360ab5e3014b5
Contents?: true
Size: 1.82 KB
Versions: 36
Compression:
Stored size: 1.82 KB
Contents
(function() { var activate, onContentBrowserSave; activate = function(element) { var cmsField, objId; cmsField = $(element); if (!cmsField.is('video, audio, img')) { objId = cmsField.scrivito('content'); if (objId && !cmsField.children().length) { scrivito.description_for_editor([objId]).then(function(results) { return cmsField.text(results[0]); }); } } return cmsField.on('click', function(event) { var filterContext, filters, isImage, selected; event.preventDefault(); selected = [cmsField.scrivito('content')].filter(function(element) { return element; }); isImage = cmsField.is('img'); filters = cmsField.data('scrivitoEditorsFilters'); filterContext = $.extend({ _image: isImage }, cmsField.data('scrivitoEditorsFilterContext')); return scrivito.content_browser.open({ filters: filters, filter_context: filterContext, selection: selected, selection_mode: 'single' }).done((function(_this) { return function(selection) { return onContentBrowserSave(selection, cmsField); }; })(this)); }); }; onContentBrowserSave = function(selection, cmsField) { var value; value = selection[0] || null; cmsField.scrivito('save', value).done(function() { cmsField.trigger('save.scrivito_editors'); return cmsField.scrivito('reload'); }); return true; }; scrivito.editors.reference_editor = { can_edit: function(element) { return $(element).is('[data-scrivito-field-type=reference]'); }, activate: function(element) { return activate(element); } }; scrivito.on('load', function() { return scrivito.define_editor('reference', scrivito.editors.reference_editor); }); }).call(this);
Version data entries
36 entries across 36 versions & 1 rubygems