Sha256: 226f236f9b899c11b7b2593bdc6f047f19915c34ef5bfc670dcdb951b68a1c59
Contents?: true
Size: 703 Bytes
Versions: 11
Compression:
Stored size: 703 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| format = { id: obj.id, file_type: obj.obj_class, file_size: ConverterHelper.human_binary_length(obj), last_changed: obj[:_last_changed], title: obj.description_for_editor.presence || obj.binary.try(:filename), subtitle: obj.info_for_content_browser, mime_type: obj.binary_content_type, } if obj.binary_content_type && obj.binary_content_type.start_with?('image/') binary = obj.binary.transform(width: 260, height: 140) format[:preview] = view_context.scrivito_path(binary) end format end
Version data entries
11 entries across 11 versions & 1 rubygems