Sha256: a29f0a131d053d2d395839b1fd8533c2dd53432fc94c82eb07ba31ab631cc5dc
Contents?: true
Size: 1.13 KB
Versions: 17
Compression:
Stored size: 1.13 KB
Contents
$ -> # Define editor behavior for enum attributes. scrivito.on 'load', -> if scrivito.in_editable_view() template = (values) -> element = $('<select></select>') .addClass('form-control') $.each values, (index, value) -> $('<option></option>') .attr('value', value) .text(value) .appendTo(element) element save = (event) -> element = $(event.currentTarget) cmsField = element.data('cmsField') content = element.val() cmsField.scrivito('save', content).done -> cmsField.trigger('save.scrivito_editors') enumEditSelector = '[data-values][data-scrivito-field-type="enum"]' + ':not([data-editor]), [data-editor~="enum"]' $(document).on 'click', enumEditSelector, (event) -> cmsField = $(event.currentTarget) selected = cmsField.scrivito('content') values = cmsField.data('values') template(values) .data('cmsField', cmsField) .val(selected) .insertAfter(cmsField) .focusout(save) .focus() cmsField.hide()
Version data entries
17 entries across 17 versions & 1 rubygems