Enable markdown formatting for snippets in projects.

This commit is contained in:
Takao Baba 2014-02-03 22:16:59 +09:00 committed by Takao Baba
parent c573265891
commit c52bc838cd
3 changed files with 17 additions and 20 deletions

View File

@ -6,9 +6,5 @@
.btn-group.tree-btn-group.pull-right
- if can?(current_user, :admin_project_snippet, @project) || @snippet.author == current_user
= link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-tiny", title: 'Edit Snippet'
= link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank"
.file-content.code
- unless @snippet.content.empty?
= render 'shared/file_hljs', blob: @snippet
- else
%p.nothing_here_message Empty file
= link_to "Raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank"
= render 'snippets/blob_content'

View File

@ -8,17 +8,4 @@
= link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet'
= link_to "Delete", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet'
= link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank"
- unless @snippet.content.empty?
- if gitlab_markdown?(@snippet.file_name)
.file-content.wiki
= preserve do
= markdown(@snippet.data)
- elsif markup?(@snippet.file_name)
.file-content.wiki
= render_markup(@snippet.file_name, @snippet.data)
- else
.file-content.code
= render 'shared/file_hljs', blob: @snippet
- else
.file-content.code
%p.nothing_here_message Empty file
= render 'snippets/blob_content'

View File

@ -0,0 +1,14 @@
- unless @snippet.content.empty?
- if gitlab_markdown?(@snippet.file_name)
.file-content.wiki
= preserve do
= markdown(@snippet.data)
- elsif markup?(@snippet.file_name)
.file-content.wiki
= render_markup(@snippet.file_name, @snippet.data)
- else
.file-content.code
= render 'shared/file_hljs', blob: @snippet
- else
.file-content.code
%p.nothing_here_message Empty file