2018-08-03 13:22:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-06 17:28:06 -04:00
|
|
|
module DiffViewer
|
|
|
|
class Image < Base
|
|
|
|
include Rich
|
|
|
|
include ClientSide
|
|
|
|
|
|
|
|
self.partial_name = 'image'
|
2019-09-23 14:06:14 -04:00
|
|
|
self.extensions = UploaderHelper::SAFE_IMAGE_EXT
|
2017-06-06 17:28:06 -04:00
|
|
|
self.binary = true
|
2020-07-13 08:09:18 -04:00
|
|
|
self.switcher_icon = 'doc-image'
|
2018-12-13 12:49:05 -05:00
|
|
|
self.switcher_title = _('image diff')
|
2020-10-28 08:08:40 -04:00
|
|
|
|
|
|
|
def self.can_render?(diff_file, verify_binary: true)
|
|
|
|
# When both blobs are missing, we often still have a textual diff that can
|
|
|
|
# be displayed
|
|
|
|
return false if diff_file.old_blob.nil? && diff_file.new_blob.nil?
|
|
|
|
|
|
|
|
super
|
|
|
|
end
|
2017-06-06 17:28:06 -04:00
|
|
|
end
|
|
|
|
end
|