Commit d7701a26 authored by Robert Schilling's avatar Robert Schilling

Move calls to Gitlab::MarkdownHelper to application_helper

parent 99eb2831
......@@ -226,6 +226,14 @@ module ApplicationHelper
simple_format(file_content)
end
def markup?(filename)
Gitlab::MarkdownHelper.markup?(filename)
end
def gitlab_markdown?(filename)
Gitlab::MarkdownHelper.gitlab_markdown?(filename)
end
def spinner(text = nil, visible = false)
css_class = "loading"
css_class << " hide" unless visible
......
......@@ -22,9 +22,9 @@ module TreeHelper
end
def render_readme(readme)
if Gitlab::MarkdownHelper.gitlab_markdown?(readme.name)
if gitlab_markdown?(readme.name)
preserve(markdown(readme.data))
elsif Gitlab::MarkdownHelper.markup?(readme.name)
elsif markup?(readme.name)
render_markup(readme.name, readme.data)
else
simple_format(readme.data)
......@@ -90,8 +90,7 @@ module TreeHelper
end
def editing_preview_title(filename)
if Gitlab::MarkdownHelper.gitlab_markdown?(filename) ||
Gitlab::MarkdownHelper.markup?(filename)
if gitlab_markdown?(filename) || markup?(filename)
'Preview'
else
'Diff'
......
class Tree
include Gitlab::MarkdownHelper
attr_accessor :entries, :readme, :contribution_guide
def initialize(repository, sha, path = '/')
......@@ -13,8 +15,7 @@ class Tree
# by markup renderer.
if available_readmes.length > 1
supported_readmes = available_readmes.select do |readme|
Gitlab::MarkdownHelper.gitlab_markdown?(readme.name) ||
Gitlab::MarkdownHelper.markup?(readme.name)
gitlab_markdown?(readme.name) || markup?(readme.name)
end
# Take the first supported readme, or the first available readme, if we
......
- if Gitlab::MarkdownHelper.gitlab_markdown?(blob.name)
- if gitlab_markdown?(blob.name)
.file-content.wiki
= preserve do
= markdown(blob.data)
- elsif Gitlab::MarkdownHelper.markup?(blob.name)
- elsif markup?(blob.name)
.file-content.wiki
= render_markup(blob.name, blob.data)
- else
......
.diff-file
.diff-content
- if Gitlab::MarkdownHelper.gitlab_markdown?(@blob.name)
- if gitlab_markdown?(@blob.name)
.file-content.wiki
= preserve do
= markdown(@content)
- elsif Gitlab::MarkdownHelper.markup?(@blob.name)
- elsif markup?(@blob.name)
.file-content.wiki
= raw GitHub::Markup.render(@blob.name, @content)
= raw render_markup(@blob.name, @content)
- else
.file-content.code
- unless @diff.empty?
......
- unless @snippet.content.empty?
- if Gitlab::MarkdownHelper.gitlab_markdown?(@snippet.file_name)
- if gitlab_markdown?(@snippet.file_name)
.file-content.wiki
= preserve do
= markdown(@snippet.data)
- elsif Gitlab::MarkdownHelper.markup?(@snippet.file_name)
- elsif markup?(@snippet.file_name)
.file-content.wiki
= render_markup(@snippet.file_name, @snippet.data)
- else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment