Merge pull request #7963 from cirosantilli/factor-previewable

Factor markup? || gitlab_markdown? into new method
This commit is contained in:
Dmitriy Zaporozhets 2014-10-07 12:19:28 +03:00
commit 7bcd6f79a4
3 changed files with 6 additions and 2 deletions

View file

@ -90,7 +90,7 @@ module TreeHelper
end
def editing_preview_title(filename)
if gitlab_markdown?(filename) || markup?(filename)
if Gitlab::MarkdownHelper.previewable?(filename)
'Preview'
else
'Diff'

View file

@ -15,7 +15,7 @@ class Tree
# by markup renderer.
if available_readmes.length > 1
supported_readmes = available_readmes.select do |readme|
gitlab_markdown?(readme.name) || markup?(readme.name)
previewable?(readme.name)
end
# Take the first supported readme, or the first available readme, if we

View file

@ -21,5 +21,9 @@ module Gitlab
def gitlab_markdown?(filename)
filename.downcase.end_with?(*%w(.mdown .md .markdown))
end
def previewable?(filename)
gitlab_markdown?(filename) || markup?(filename)
end
end
end