Sha256: 202e7dcd75449d3ae60886da6f5699bc37613abc1b51582af5dd633c6c4b24d6

Contents?: true

Size: 534 Bytes

Versions: 11

Compression:

Stored size: 534 Bytes

Contents

# Register a JavaScript search API result format used by the content browser.
Scrivito::Configuration.register_obj_format('content_browser') do |obj, _, view_context|
  has_details_view = view_context.lookup_context.exists?(obj.details_view_path)

  format = {
    id: obj.id,
    title: obj.description_for_editor.presence || obj.binary.try(:filename),
    has_details_view: has_details_view
  }

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

  format
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
scrivito_content_browser-0.42.1 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.42.1.rc3 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.42.1.rc2 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.42.1.rc1 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.42.0 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.41.1 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.41.0 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.41.0.rc2 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.41.0.rc1 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.40.0 config/initializers/scrivito_content_browser.rb
scrivito_content_browser-0.40.0.rc2 config/initializers/scrivito_content_browser.rb