Sha256: 53def06cd58b850b643863bd6553b999b335b750d53268963fa36711ca4bce05
Contents?: true
Size: 1.17 KB
Versions: 14
Compression:
Stored size: 1.17 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') filterContext = $.extend {_image: cmsField.is('img')}, cmsField.data('filterContext') # Open content browser with current reference selected. scrivito.content_browser.open filters: filters filter_context: filterContext selection: selected 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
14 entries across 14 versions & 1 rubygems