Sha256: 3bb4a71c63a1b0cc32ad51148814cc1aac89b3e89f89f9551d2a315386b4e37e
Contents?: true
Size: 1.06 KB
Versions: 23
Compression:
Stored size: 1.06 KB
Contents
$ -> # Integrates a content browser based editor for reference CMS attributes. scrivito.on 'load', -> if scrivito.in_editable_view() $('body').on 'click', '[data-scrivito-field-type="reference"]:not([data-editor]), [data-editor~="reference"]', (event) -> event.preventDefault() cmsField = $(event.currentTarget) selected = [cmsField.scrivito('content')].filter (element) -> element filters = cmsField.data('filters') || cmsField.data('filter') # Open content browser with current reference selected. scrivito.content_browser.open selection: selected filters: filters selection_mode: 'single' .done (selection) => onContentBrowserSave(selection, cmsField) # Save single reference when content browser calls "save". onContentBrowserSave = (selection, cmsField) -> value = selection[0] || null cmsField.scrivito('save', value) .done -> cmsField.trigger('save.scrivito_editors') cmsField.scrivito('reload') true
Version data entries
23 entries across 23 versions & 1 rubygems