Sha256: e8dd44cbb10a36814b74ec727bad730df9f656cd10f9b038fbb144a5b990f3b3
Contents?: true
Size: 1.33 KB
Versions: 45
Compression:
Stored size: 1.33 KB
Contents
(function() { var activate, save; activate = function(element) { return scrivito.editors._file_dropzone($(element), save); }; save = function(field, file) { var objClass; objClass = scrivito.default_obj_class_for_content_type(file.type); return scrivito.create_obj({ blob: file, _obj_class: objClass }).then(function(obj) { var type, value; type = field.attr('data-scrivito-field-type'); value = (function() { switch (type) { case 'link': return { obj_id: obj.id }; case 'linklist': return [ { obj_id: obj.id } ]; case 'reference': return obj.id; } })(); return field.scrivito('save', value).then(function() { return field.scrivito('reload'); }); }); }; scrivito.editors.image_drop_editor = { can_edit: function(element) { return $(element).is('img[data-scrivito-field-type=link],\nimg[data-scrivito-field-type=linklist],\nimg[data-scrivito-field-type=reference]'); }, activate: function(element) { return activate(element); } }; scrivito.on('load', function() { return scrivito.define_editor('image_drop', scrivito.editors.image_drop_editor); }); }).call(this);
Version data entries
45 entries across 45 versions & 1 rubygems