Sha256: 8afce81a544344d35da9316f73b9793482788f45da2ca7fd0f65737c4eab4dc1
Contents?: true
Size: 1.06 KB
Versions: 1
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 selectionMode: '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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scrivito_editors-0.40.0.rc1 | app/assets/javascripts/scrivito_editors/reference_editor.js.coffee |