Sha256: 434f67cd2b8e5ffa3e5d360363ca58a263826edaef4ca8b01932dbae583d1f7b
Contents?: true
Size: 1.94 KB
Versions: 45
Compression:
Stored size: 1.94 KB
Contents
(function() { var activate, onClose, onSelect, save, template; template = function() { return $('<input />').attr('type', 'text'); }; save = function(datetimepickerElement, dateTimeText, additionalDoneEvent) { var cmsField, datetime; cmsField = datetimepickerElement.data('cmsField'); datetime = datetimepickerElement.datetimepicker('getDate'); return cmsField.scrivito('save', datetime).done(function() { cmsField.trigger('save.scrivito_editors'); if (additionalDoneEvent) { return cmsField.trigger(additionalDoneEvent); } }); }; onClose = function(dateTimeText) { return save($(this), dateTimeText, 'scrivito_editors:blur'); }; onSelect = function(dateTimeText) { return save($(this), dateTimeText); }; activate = function(element) { var cmsField; cmsField = $(element); return cmsField.on('click', function(event) { var content, dateFormat, options, timeFormat; if (cmsField.is('.hasDatepicker')) { return; } event.preventDefault(); content = cmsField.text().trim(); dateFormat = cmsField.data('scrivitoEditorsDateFormat'); timeFormat = cmsField.data('scrivitoEditorsTimeFormat'); options = { onClose: onClose, onSelect: onSelect }; options.dateFormat = dateFormat || 'yy-mm-dd'; if (timeFormat) { options.timeFormat = timeFormat; } template().data('cmsField', cmsField).insertAfter(cmsField).datetimepicker(options).datetimepicker('setDate', $(cmsField).scrivito('content')).focus(); return cmsField.hide(); }); }; scrivito.editors.date_editor = { can_edit: function(element) { return $(element).is('[data-scrivito-field-type=date]'); }, activate: function(element) { return activate(element); } }; scrivito.on('load', function() { return scrivito.define_editor('date', scrivito.editors.date_editor); }); }).call(this);
Version data entries
45 entries across 45 versions & 1 rubygems