Sha256: e9824de9fef280041d343e0ec35556d3918a229a6fad96d0f80ad80445566055
Contents?: true
Size: 1.73 KB
Versions: 3
Compression:
Stored size: 1.73 KB
Contents
$ -> selector = '[data-scrivito-field-type=binary]:not([data-editor])' status_indicator_class = 'image-editor-dragover' image_container_class = 'scrivito-editor-image-container' handle_file_upload = (event, element, file) -> element.scrivito('save', file).then -> element.scrivito('reload') delete_binary = (cms_field) -> if $(cms_field).scrivito('content') $(cms_field).scrivito('save', null).then -> $(cms_field).scrivito('reload') binary_field_container = (binary_field) -> if $(binary_field).prop('tagName') == 'IMG' if $(binary_field).parent(".#{image_container_class}").length == 0 $(binary_field).wrap("<div class='#{image_container_class}'></div>") $(binary_field).parent(".#{image_container_class}") else binary_field add_delete_to_binary = (binary_element) -> if $(binary_element).scrivito('content') container = binary_field_container(binary_element) if $(container).find('delete-binary').length == 0 delete_icon = $( '<a href="#" class="delete-binary editing-button editing-red delete">' + '<i class="editing-icon editing-icon-trash" /></a>' ) delete_icon.click (event) -> event.preventDefault() delete_binary(binary_element) $(container).prepend(delete_icon) scrivito.on 'content', (content_root) -> if scrivito.in_editable_view() binary_elements = $(content_root).find( "#{selector}[data-scrivito-editors-allow-delete]") for binary_element in binary_elements add_delete_to_binary(binary_element) scrivito.on 'load', -> if scrivito.in_editable_view() scrivito.editors._file_drop_zone(selector, handle_file_upload, status_indicator_class)
Version data entries
3 entries across 3 versions & 1 rubygems