Commit 899afd0067065be6b15d7b737100b82757421828
1 parent
29636d4d
Exists in
master
and in
4 other branches
Fix snippet render issue cause of haml preserve
Showing
3 changed files
with
16 additions
and
22 deletions
Show diff stats
| @@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
| 1 | +.file_holder | ||
| 2 | + .file_title | ||
| 3 | + %i.icon-file | ||
| 4 | + %strong= @snippet.file_name | ||
| 5 | + %span.options | ||
| 6 | + = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank" | ||
| 7 | + .file_content.code | ||
| 8 | + - unless @snippet.content.empty? | ||
| 9 | + %div{class: current_user.dark_scheme ? "black" : "white"} | ||
| 10 | + :preserve | ||
| 11 | + #{raw @snippet.colorize(formatter: :gitlab)} | ||
| 12 | + - else | ||
| 13 | + %p.nothing_here_message Empty file |
app/views/snippets/show.html.haml
| @@ -7,24 +7,5 @@ | @@ -7,24 +7,5 @@ | ||
| 7 | = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right" | 7 | = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right" |
| 8 | 8 | ||
| 9 | %br | 9 | %br |
| 10 | - | ||
| 11 | -%div | ||
| 12 | - .file_holder | ||
| 13 | - .file_title | ||
| 14 | - %i.icon-file | ||
| 15 | - %strong= @snippet.file_name | ||
| 16 | - %span.options | ||
| 17 | - = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank" | ||
| 18 | - .file_content.code | ||
| 19 | - - unless @snippet.content.empty? | ||
| 20 | - %div{class: current_user.dark_scheme ? "black" : "white"} | ||
| 21 | - = preserve do | ||
| 22 | - = raw Pygments.highlight(@snippet.content, formatter: :gitlab) | ||
| 23 | - - else | ||
| 24 | - %h4.nothing_here_message Empty file | ||
| 25 | - | ||
| 26 | - | ||
| 27 | -.clearfix | ||
| 28 | - | ||
| 29 | -%div#notes | ||
| 30 | - = render "notes/notes_with_form", tid: @snippet.id, tt: "snippet" | 10 | +%div= render 'blob' |
| 11 | +%div#notes= render "notes/notes_with_form", tid: @snippet.id, tt: "snippet" |
app/views/tree/blob/_text.html.haml