Sha256: 44fb464dd89b5fec945cc5d49a0c15d8b3a610b00adbe66a001c872d840e69e8

Contents?: true

Size: 397 Bytes

Versions: 1

Compression:

Stored size: 397 Bytes

Contents

# Register a JavaScript search API result format used by the content browser.
Scrivito::Configuration.register_obj_format('content_browser') do |obj|
  format = {
    id: obj.id,
    title: obj.description_for_editor.presence || obj.binary.try(:filename),
  }

  if obj.binary_content_type && obj.binary_content_type.start_with?('image/')
    format[:preview] = obj.binary_url
  end

  format
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scrivito_content_browser-0.40.0.rc1 config/initializers/scrivito_content_browser.rb