diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-13 20:04:29 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-27 20:23:26 +0300 |
commit | f112a03cba884aa67d5d601520d4c05ce517f28a (patch) | |
tree | 4410ef7ffa96d2aed75329326a4656bfc278086b /app/models | |
parent | 13891a03c7388315bb66b30cd0b8e87fa21958b0 (diff) |
Add simple blob viewers
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/blob_viewer/client_side.rb | 11 | ||||
-rw-r--r-- | app/models/blob_viewer/download.rb | 13 | ||||
-rw-r--r-- | app/models/blob_viewer/empty.rb | 9 | ||||
-rw-r--r-- | app/models/blob_viewer/simple.rb | 11 | ||||
-rw-r--r-- | app/models/blob_viewer/text.rb | 11 |
5 files changed, 55 insertions, 0 deletions
diff --git a/app/models/blob_viewer/client_side.rb b/app/models/blob_viewer/client_side.rb new file mode 100644 index 00000000000..42ec68f864b --- /dev/null +++ b/app/models/blob_viewer/client_side.rb @@ -0,0 +1,11 @@ +module BlobViewer + module ClientSide + extend ActiveSupport::Concern + + included do + self.client_side = true + self.max_size = 10.megabytes + self.absolute_max_size = 50.megabytes + end + end +end diff --git a/app/models/blob_viewer/download.rb b/app/models/blob_viewer/download.rb new file mode 100644 index 00000000000..45cb38a3268 --- /dev/null +++ b/app/models/blob_viewer/download.rb @@ -0,0 +1,13 @@ +module BlobViewer + class Download < Base + include Simple + include ServerSide + + self.partial_name = 'download' + self.text_based = false + + def render_error(*) + nil + end + end +end diff --git a/app/models/blob_viewer/empty.rb b/app/models/blob_viewer/empty.rb new file mode 100644 index 00000000000..60003a7c12a --- /dev/null +++ b/app/models/blob_viewer/empty.rb @@ -0,0 +1,9 @@ +module BlobViewer + class Empty < Base + include Simple + include ServerSide + + self.partial_name = 'empty' + self.text_based = false + end +end diff --git a/app/models/blob_viewer/simple.rb b/app/models/blob_viewer/simple.rb new file mode 100644 index 00000000000..454a20495fc --- /dev/null +++ b/app/models/blob_viewer/simple.rb @@ -0,0 +1,11 @@ +module BlobViewer + module Simple + extend ActiveSupport::Concern + + included do + self.type = :simple + self.switcher_icon = 'code' + self.switcher_title = 'source' + end + end +end diff --git a/app/models/blob_viewer/text.rb b/app/models/blob_viewer/text.rb new file mode 100644 index 00000000000..5f442dadf0f --- /dev/null +++ b/app/models/blob_viewer/text.rb @@ -0,0 +1,11 @@ +module BlobViewer + class Text < Base + include Simple + include ServerSide + + self.partial_name = 'text' + self.text_based = true + self.max_size = 1.megabyte + self.absolute_max_size = 10.megabytes + end +end |