summaryrefslogtreecommitdiff
path: root/app/helpers/wiki_helper.rb
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2018-02-05 17:17:21 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-02-05 17:17:21 +0000
commit27c08a16891193227fc83bf4692b4d31a3b2539f (patch)
treeecf87006574bee3e9ede3cd3ac9b3ac4bda6f427 /app/helpers/wiki_helper.rb
parent0a30a9ea595530499e2d3ae8062506b0a94eebad (diff)
downloadgitlab-ce-27c08a16891193227fc83bf4692b4d31a3b2539f.tar.gz
Allow moving wiki pages from the UI
Diffstat (limited to 'app/helpers/wiki_helper.rb')
-rw-r--r--app/helpers/wiki_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb
index 815fab9e061..41f9eedd4bd 100644
--- a/app/helpers/wiki_helper.rb
+++ b/app/helpers/wiki_helper.rb
@@ -21,4 +21,22 @@ module WikiHelper
add_to_breadcrumb_dropdown link_to(WikiPage.unhyphenize(dir_or_page).capitalize, project_wiki_path(@project, current_slug)), location: :after
end
end
+
+ def wiki_page_errors(error)
+ return unless error
+
+ content_tag(:div, class: 'alert alert-danger') do
+ case error
+ when WikiPage::PageChangedError
+ page_link = link_to s_("WikiPageConflictMessage|the page"), project_wiki_path(@project, @page), target: "_blank"
+ concat(
+ (s_("WikiPageConflictMessage|Someone edited the page the same time you did. Please check out %{page_link} and make sure your changes will not unintentionally remove theirs.") % { page_link: page_link }).html_safe
+ )
+ when WikiPage::PageRenameError
+ s_("WikiEdit|There is already a page with the same title in that path.")
+ else
+ error.message
+ end
+ end
+ end
end