Sha256: afe5e2022749430d54ddceb24b30705ed193fde6c7a2717a3073eb5132aa16e3
Contents?: true
Size: 904 Bytes
Versions: 19
Compression:
Stored size: 904 Bytes
Contents
$ -> # Display a placeholder for empty CMS attributes. The placeholder can be overwritten by # defining a +data-placeholder+ HTML attribute on the DOM element generated by +scrivito_tag+. # # For example: # scrivito_tag(:div, @obj, :my_attribute, data: { placeholder: 'My custom placeholder text.' }) addPlaceholder = -> cmsFields = $('[data-scrivito-field-type]') .not('[data-scrivito-field-type=widgetlist]') .not('[data-scrivito-field-type$=enum]:not([data-values])') cmsFields.each -> cmsField = $(@) fieldName = cmsField.attr('data-scrivito-field-name') defaultPlaceholder = 'Click to edit the "' + fieldName + '" attribute ...' placeholder = cmsField.attr('data-placeholder') || defaultPlaceholder cmsField.attr('data-placeholder', placeholder) scrivito.on 'content', -> if scrivito.in_editable_view() addPlaceholder()
Version data entries
19 entries across 19 versions & 1 rubygems