blob: 70a373619d6bfb1570d7d1dcb38ed4c1a96e3dd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# frozen_string_literal: true
class SnippetBlobPresenter < BlobPresenter
def rich_data
return if blob.binary?
if markup?
blob.rendered_markup
else
highlight(plain: false)
end
end
def plain_data
return if blob.binary?
highlight(plain: !markup?)
end
def raw_path
if snippet.is_a?(ProjectSnippet)
raw_project_snippet_path(snippet.project, snippet)
else
raw_snippet_path(snippet)
end
end
private
def markup?
blob.rich_viewer&.partial_name == 'markup'
end
def snippet
blob.snippet
end
def language
nil
end
end
|