Sha256: 9bfaac6750a2cda17231f3930f68a82b03234eaa3a9457e12ed0cdeac79f502e
Contents?: true
Size: 1.53 KB
Versions: 27
Compression:
Stored size: 1.53 KB
Contents
$ -> # Define editor behavior for date attributes. scrivito.on 'load', -> if scrivito.in_editable_view() template = -> $('<input />') .attr('type', 'text') onKeyup = (event) -> key = event.keyCode || event.which switch key when 27 # Esc # Prevent the property view to close when the ESC key is pressed. event.stopPropagation() save = (dateTimeText) -> datetimepicker_element = $(this) cmsField = datetimepicker_element.data('cmsField') datetime = datetimepicker_element.datetimepicker('getDate') cmsField.scrivito('save', datetime) .done -> cmsField.trigger('save.scrivito_editors') cmsField.scrivito('reload') $('body').on 'click', '[data-scrivito-field-type="date"]:not(.hasDatepicker):not([data-editor]), [data-editor~="date"]', (event) -> event.preventDefault() cmsField = $(this) content = cmsField.text().trim() $('body').keyup(onKeyup) dateFormat = cmsField.attr('data-date-format') timeFormat = cmsField.attr('data-time-format') options = onClose: save options.dateFormat = dateFormat || 'yy-mm-dd' options.timeFormat = timeFormat if timeFormat template() .data('cmsField', cmsField) .insertAfter(cmsField) .keyup(onKeyup) .datetimepicker(options) .datetimepicker('setDate', $(cmsField).scrivito('content')) .focus() cmsField.hide()
Version data entries
27 entries across 27 versions & 1 rubygems