Fix snippet render issue cause of haml preserve
This commit is contained in:
parent
29636d4dab
commit
899afd0067
3 changed files with 16 additions and 22 deletions
13
app/views/snippets/_blob.html.haml
Normal file
13
app/views/snippets/_blob.html.haml
Normal file
|
@ -0,0 +1,13 @@
|
|||
.file_holder
|
||||
.file_title
|
||||
%i.icon-file
|
||||
%strong= @snippet.file_name
|
||||
%span.options
|
||||
= link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"
|
||||
.file_content.code
|
||||
- unless @snippet.content.empty?
|
||||
%div{class: current_user.dark_scheme ? "black" : "white"}
|
||||
:preserve
|
||||
#{raw @snippet.colorize(formatter: :gitlab)}
|
||||
- else
|
||||
%p.nothing_here_message Empty file
|
|
@ -7,24 +7,5 @@
|
|||
= link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right"
|
||||
|
||||
%br
|
||||
|
||||
%div
|
||||
.file_holder
|
||||
.file_title
|
||||
%i.icon-file
|
||||
%strong= @snippet.file_name
|
||||
%span.options
|
||||
= link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"
|
||||
.file_content.code
|
||||
- unless @snippet.content.empty?
|
||||
%div{class: current_user.dark_scheme ? "black" : "white"}
|
||||
= preserve do
|
||||
= raw Pygments.highlight(@snippet.content, formatter: :gitlab)
|
||||
- else
|
||||
%h4.nothing_here_message Empty file
|
||||
|
||||
|
||||
.clearfix
|
||||
|
||||
%div#notes
|
||||
= render "notes/notes_with_form", tid: @snippet.id, tt: "snippet"
|
||||
%div= render 'blob'
|
||||
%div#notes= render "notes/notes_with_form", tid: @snippet.id, tt: "snippet"
|
||||
|
|
|
@ -12,4 +12,4 @@
|
|||
= preserve do
|
||||
= raw blob.colorize(formatter: :gitlab)
|
||||
- else
|
||||
%h4.nothing_here_message Empty file
|
||||
%p.nothing_here_message Empty file
|
||||
|
|
Loading…
Reference in a new issue