Sha256: e17aeb189d52a6e60653476151e05b093e5e555dded89a802014cf959f632a12
Contents?: true
Size: 861 Bytes
Versions: 50
Compression:
Stored size: 861 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, [], false, [], formats: [:html]) 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, has_details_view: has_details_view } 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
50 entries across 50 versions & 1 rubygems