diff options
Diffstat (limited to 'app/helpers/wiki_helper.rb')
-rw-r--r-- | app/helpers/wiki_helper.rb | 18 |
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 |