summaryrefslogtreecommitdiff
path: root/app/models/blob_viewer/license.rb
blob: 3ad49570c88f0dd8c04031c2266a02fe206b32cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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