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

Set BlobViewer::Base.binary instead of .text

parent a2f4650f
module BlobViewer
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
......@@ -31,12 +31,12 @@ module BlobViewer
!client_side?
end
def self.text?
text_based
def self.binary?
binary
end
def self.binary?
!text?
def self.text?
!binary?
end
def self.can_render?(blob)
......
......@@ -5,6 +5,6 @@ module BlobViewer
self.partial_name = 'stl'
self.extensions = %w(stl)
self.text_based = false
self.binary = true
end
end
......@@ -7,7 +7,7 @@ module BlobViewer
include ClientSide
self.partial_name = 'download'
self.text_based = false
self.binary = true
def render_error
nil
......
......@@ -4,6 +4,6 @@ module BlobViewer
include ServerSide
self.partial_name = 'empty'
self.text_based = false
self.binary = true
end
end
......@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'image'
self.extensions = UploaderHelper::IMAGE_EXT
self.text_based = false
self.binary = true
self.switcher_icon = 'picture-o'
self.switcher_title = 'image'
end
......
......@@ -5,6 +5,6 @@ module BlobViewer
self.partial_name = 'markup'
self.extensions = Gitlab::MarkupHelper::EXTENSIONS
self.text_based = true
self.binary = false
end
end
......@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'notebook'
self.extensions = %w(ipynb)
self.text_based = true
self.binary = false
self.switcher_icon = 'file-text-o'
self.switcher_title = 'notebook'
end
......
......@@ -2,10 +2,10 @@ module BlobViewer
class PDF < Base
include Rich
include ClientSide
self.partial_name = 'pdf'
self.extensions = %w(pdf)
self.text_based = false
self.binary = true
self.switcher_icon = 'file-pdf-o'
self.switcher_title = 'PDF'
end
......
......@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'sketch'
self.extensions = %w(sketch)
self.text_based = false
self.binary = true
self.switcher_icon = 'file-image-o'
self.switcher_title = 'preview'
end
......
......@@ -5,7 +5,7 @@ module BlobViewer
self.partial_name = 'svg'
self.extensions = %w(svg)
self.text_based = true
self.binary = false
self.switcher_icon = 'picture-o'
self.switcher_title = 'image'
end
......
......@@ -4,7 +4,7 @@ module BlobViewer
include ServerSide
self.partial_name = 'text'
self.text_based = true
self.binary = false
self.max_size = 1.megabyte
self.absolute_max_size = 10.megabytes
end
......
......@@ -5,6 +5,6 @@ module BlobViewer
self.partial_name = 'stl'
self.extensions = %w(stl)
self.text_based = true
self.binary = false
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