Sha256: 39f334963f508ba22f38f808057aa144c850c0de234893ab844f98c7331522ce

Contents?: true

Size: 329 Bytes

Versions: 2

Compression:

Stored size: 329 Bytes

Contents

# Register a JavaScript search API result format used by the resource browser.
Scrivito::Configuration.register_obj_format('resourcebrowser') do |obj|
  format = {
    id: obj.id,
    title: obj.description_for_editor,
  }

  if obj.respond_to?(:image?) && obj.image?
    format[:preview] = obj.body_data_url
  end

  format
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrivito_resourcebrowser-0.0.6 config/initializers/resourcebrowser.rb
scrivito_resourcebrowser-0.0.5 config/initializers/resourcebrowser.rb