summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-04-03 12:04:42 +0200
committerToon Claes <toon@gitlab.com>2017-04-27 13:22:17 +0200
commitef4d4446e957ecbb086859d96185a27af168d11c (patch)
tree9e7059a8d17afb3aaaef5a39720194c36e263643 /app
parentd95bffc6dad3e6d999fb4d5c8c66d7fea05c73b7 (diff)
downloadgitlab-ce-ef4d4446e957ecbb086859d96185a27af168d11c.tar.gz
Move some methods from ApplicationHelper to MarkupHelper
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb32
-rw-r--r--app/helpers/markup_helper.rb32
2 files changed, 32 insertions, 32 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e5b811f3300..fff57472a4f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -196,38 +196,6 @@ module ApplicationHelper
end
end
- def render_markup(file_name, file_content)
- if gitlab_markdown?(file_name)
- Hamlit::RailsHelpers.preserve(markdown(file_content))
- elsif asciidoc?(file_name)
- asciidoc(file_content)
- elsif plain?(file_name)
- content_tag :pre, class: 'plain-readme' do
- file_content
- end
- else
- other_markup(file_name, file_content)
- end
- rescue RuntimeError
- simple_format(file_content)
- end
-
- def plain?(filename)
- Gitlab::MarkupHelper.plain?(filename)
- end
-
- def markup?(filename)
- Gitlab::MarkupHelper.markup?(filename)
- end
-
- def gitlab_markdown?(filename)
- Gitlab::MarkupHelper.gitlab_markdown?(filename)
- end
-
- def asciidoc?(filename)
- Gitlab::MarkupHelper.asciidoc?(filename)
- end
-
def promo_host
'about.gitlab.com'
end
diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb
index a10714e81ae..f82791b88fa 100644
--- a/app/helpers/markup_helper.rb
+++ b/app/helpers/markup_helper.rb
@@ -1,6 +1,22 @@
require 'nokogiri'
module MarkupHelper
+ def plain?(filename)
+ Gitlab::MarkupHelper.plain?(filename)
+ end
+
+ def markup?(filename)
+ Gitlab::MarkupHelper.markup?(filename)
+ end
+
+ def gitlab_markdown?(filename)
+ Gitlab::MarkupHelper.gitlab_markdown?(filename)
+ end
+
+ def asciidoc?(filename)
+ Gitlab::MarkupHelper.asciidoc?(filename)
+ end
+
# Use this in places where you would normally use link_to(gfm(...), ...).
#
# It solves a problem occurring with nested links (i.e.
@@ -110,6 +126,22 @@ module MarkupHelper
end
end
+ def render_markup(file_name, file_content)
+ if gitlab_markdown?(file_name)
+ Hamlit::RailsHelpers.preserve(markdown(file_content))
+ elsif asciidoc?(file_name)
+ asciidoc(file_content)
+ elsif plain?(file_name)
+ content_tag :pre, class: 'plain-readme' do
+ file_content
+ end
+ else
+ other_markup(file_name, file_content)
+ end
+ rescue RuntimeError
+ simple_format(file_content)
+ end
+
# Returns the text necessary to reference `entity` across projects
#
# project - Project to reference