summaryrefslogtreecommitdiff
path: root/app/models/blob_viewer/license.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/blob_viewer/license.rb')
-rw-r--r--app/models/blob_viewer/license.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/models/blob_viewer/license.rb b/app/models/blob_viewer/license.rb
new file mode 100644
index 00000000000..3ad49570c88
--- /dev/null
+++ b/app/models/blob_viewer/license.rb
@@ -0,0 +1,23 @@
+module BlobViewer
+ class License < Base
+ # We treat the License viewer as if it renders the content client-side,
+ # so that it doesn't attempt to load the entire blob contents and is
+ # rendered synchronously instead of loaded asynchronously.
+ include ClientSide
+ include Auxiliary
+
+ self.partial_name = 'license'
+ self.file_type = :license
+ self.binary = false
+
+ def license
+ blob.project.repository.license
+ end
+
+ def render_error
+ return if license
+
+ :unknown_license
+ end
+ end
+end