Commit c52bc838cdf04f7b2a06fe02f5cfaf23e0e5bdc6
Committed by
Takao Baba
1 parent
c5732658
Exists in
spb-stable
and in
3 other branches
Enable markdown formatting for snippets in projects.
Showing
3 changed files
with
17 additions
and
20 deletions
Show diff stats
app/views/projects/snippets/_blob.html.haml
@@ -6,9 +6,5 @@ | @@ -6,9 +6,5 @@ | ||
6 | .btn-group.tree-btn-group.pull-right | 6 | .btn-group.tree-btn-group.pull-right |
7 | - if can?(current_user, :admin_project_snippet, @project) || @snippet.author == current_user | 7 | - if can?(current_user, :admin_project_snippet, @project) || @snippet.author == current_user |
8 | = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-tiny", title: 'Edit Snippet' | 8 | = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-tiny", title: 'Edit Snippet' |
9 | - = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank" | ||
10 | - .file-content.code | ||
11 | - - unless @snippet.content.empty? | ||
12 | - = render 'shared/file_hljs', blob: @snippet | ||
13 | - - else | ||
14 | - %p.nothing_here_message Empty file | 9 | + = link_to "Raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank" |
10 | + = render 'snippets/blob_content' |
app/views/snippets/_blob.html.haml
@@ -8,17 +8,4 @@ | @@ -8,17 +8,4 @@ | ||
8 | = link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet' | 8 | = link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet' |
9 | = link_to "Delete", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet' | 9 | = link_to "Delete", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet' |
10 | = link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank" | 10 | = link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank" |
11 | - - unless @snippet.content.empty? | ||
12 | - - if gitlab_markdown?(@snippet.file_name) | ||
13 | - .file-content.wiki | ||
14 | - = preserve do | ||
15 | - = markdown(@snippet.data) | ||
16 | - - elsif markup?(@snippet.file_name) | ||
17 | - .file-content.wiki | ||
18 | - = render_markup(@snippet.file_name, @snippet.data) | ||
19 | - - else | ||
20 | - .file-content.code | ||
21 | - = render 'shared/file_hljs', blob: @snippet | ||
22 | - - else | ||
23 | - .file-content.code | ||
24 | - %p.nothing_here_message Empty file | 11 | + = render 'snippets/blob_content' |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +- unless @snippet.content.empty? | ||
2 | + - if gitlab_markdown?(@snippet.file_name) | ||
3 | + .file-content.wiki | ||
4 | + = preserve do | ||
5 | + = markdown(@snippet.data) | ||
6 | + - elsif markup?(@snippet.file_name) | ||
7 | + .file-content.wiki | ||
8 | + = render_markup(@snippet.file_name, @snippet.data) | ||
9 | + - else | ||
10 | + .file-content.code | ||
11 | + = render 'shared/file_hljs', blob: @snippet | ||
12 | +- else | ||
13 | + .file-content.code | ||
14 | + %p.nothing_here_message Empty file |