Commit 0b3ff9c8 authored by Douwe Maan's avatar Douwe Maan

Set BlobViewer::Base.binary instead of .text

parent a2f4650f
module BlobViewer module BlobViewer
class Base class Base
class_attribute :partial_name, :type, :extensions, :client_side, :text_based, :switcher_icon, :switcher_title, :max_size, :absolute_max_size class_attribute :partial_name, :type, :extensions, :client_side, :binary, :switcher_icon, :switcher_title, :max_size, :absolute_max_size
delegate :partial_path, :rich?, :simple?, :client_side?, :server_side?, :text?, :binary?, to: :class delegate :partial_path, :rich?, :simple?, :client_side?, :server_side?, :text?, :binary?, to: :class
...@@ -31,12 +31,12 @@ module BlobViewer ...@@ -31,12 +31,12 @@ module BlobViewer
!client_side? !client_side?
end end
def self.text? def self.binary?
text_based binary
end end
def self.binary? def self.text?
!text? !binary?
end end
def self.can_render?(blob) def self.can_render?(blob)
......
...@@ -5,6 +5,6 @@ module BlobViewer ...@@ -5,6 +5,6 @@ module BlobViewer
self.partial_name = 'stl' self.partial_name = 'stl'
self.extensions = %w(stl) self.extensions = %w(stl)
self.text_based = false self.binary = true
end end
end end
...@@ -7,7 +7,7 @@ module BlobViewer ...@@ -7,7 +7,7 @@ module BlobViewer
include ClientSide include ClientSide
self.partial_name = 'download' self.partial_name = 'download'
self.text_based = false self.binary = true
def render_error def render_error
nil nil
......
...@@ -4,6 +4,6 @@ module BlobViewer ...@@ -4,6 +4,6 @@ module BlobViewer
include ServerSide include ServerSide
self.partial_name = 'empty' self.partial_name = 'empty'
self.text_based = false self.binary = true
end end
end end
...@@ -5,7 +5,7 @@ module BlobViewer ...@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'image' self.partial_name = 'image'
self.extensions = UploaderHelper::IMAGE_EXT self.extensions = UploaderHelper::IMAGE_EXT
self.text_based = false self.binary = true
self.switcher_icon = 'picture-o' self.switcher_icon = 'picture-o'
self.switcher_title = 'image' self.switcher_title = 'image'
end end
......
...@@ -5,6 +5,6 @@ module BlobViewer ...@@ -5,6 +5,6 @@ module BlobViewer
self.partial_name = 'markup' self.partial_name = 'markup'
self.extensions = Gitlab::MarkupHelper::EXTENSIONS self.extensions = Gitlab::MarkupHelper::EXTENSIONS
self.text_based = true self.binary = false
end end
end end
...@@ -5,7 +5,7 @@ module BlobViewer ...@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'notebook' self.partial_name = 'notebook'
self.extensions = %w(ipynb) self.extensions = %w(ipynb)
self.text_based = true self.binary = false
self.switcher_icon = 'file-text-o' self.switcher_icon = 'file-text-o'
self.switcher_title = 'notebook' self.switcher_title = 'notebook'
end end
......
...@@ -2,10 +2,10 @@ module BlobViewer ...@@ -2,10 +2,10 @@ module BlobViewer
class PDF < Base class PDF < Base
include Rich include Rich
include ClientSide include ClientSide
self.partial_name = 'pdf' self.partial_name = 'pdf'
self.extensions = %w(pdf) self.extensions = %w(pdf)
self.text_based = false self.binary = true
self.switcher_icon = 'file-pdf-o' self.switcher_icon = 'file-pdf-o'
self.switcher_title = 'PDF' self.switcher_title = 'PDF'
end end
......
...@@ -5,7 +5,7 @@ module BlobViewer ...@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'sketch' self.partial_name = 'sketch'
self.extensions = %w(sketch) self.extensions = %w(sketch)
self.text_based = false self.binary = true
self.switcher_icon = 'file-image-o' self.switcher_icon = 'file-image-o'
self.switcher_title = 'preview' self.switcher_title = 'preview'
end end
......
...@@ -5,7 +5,7 @@ module BlobViewer ...@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'svg' self.partial_name = 'svg'
self.extensions = %w(svg) self.extensions = %w(svg)
self.text_based = true self.binary = false
self.switcher_icon = 'picture-o' self.switcher_icon = 'picture-o'
self.switcher_title = 'image' self.switcher_title = 'image'
end end
......
...@@ -4,7 +4,7 @@ module BlobViewer ...@@ -4,7 +4,7 @@ module BlobViewer
include ServerSide include ServerSide
self.partial_name = 'text' self.partial_name = 'text'
self.text_based = true self.binary = false
self.max_size = 1.megabyte self.max_size = 1.megabyte
self.absolute_max_size = 10.megabytes self.absolute_max_size = 10.megabytes
end end
......
...@@ -5,6 +5,6 @@ module BlobViewer ...@@ -5,6 +5,6 @@ module BlobViewer
self.partial_name = 'stl' self.partial_name = 'stl'
self.extensions = %w(stl) self.extensions = %w(stl)
self.text_based = true self.binary = false
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment