diff options
author | Go MAEDA <maeda@farend.jp> | 2023-12-07 13:03:36 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-12-07 13:03:36 +0000 |
commit | c08a607938ccd102396e326d97eed165efdfb548 (patch) | |
tree | 3482336d85150eea10ba4f958a4330621947376c /lib | |
parent | bb44975cb033b185949653f1c553f362d5c4c412 (diff) | |
download | redmine-c08a607938ccd102396e326d97eed165efdfb548.tar.gz redmine-c08a607938ccd102396e326d97eed165efdfb548.zip |
Merged r22496 from trunk to 5.1-stable (#39755).
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22497 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/wiki_formatting/common_mark/helper.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/redmine/wiki_formatting/common_mark/helper.rb b/lib/redmine/wiki_formatting/common_mark/helper.rb index 28e2fe10a..cfd2510ed 100644 --- a/lib/redmine/wiki_formatting/common_mark/helper.rb +++ b/lib/redmine/wiki_formatting/common_mark/helper.rb @@ -23,13 +23,8 @@ module Redmine module Helper def wikitoolbar_for(field_id, preview_url = preview_text_path) heads_for_wiki_formatter - help_file = "/help/#{current_language.to_s.downcase}/wiki_syntax_common_mark.html" - # fall back to the english help page if there is none for the current - # language - unless File.readable? Rails.public_path.join(help_file) - help_file = "/help/en/wiki_syntax_common_mark.html" - end - url = "#{Redmine::Utils.relative_url_root}#{help_file}" + url = help_path(current_language) + javascript_tag( "var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); " \ "wikiToolbar.setHelpLink('#{escape_javascript url}'); " \ @@ -38,6 +33,16 @@ module Redmine ) end + def help_path(lang) + help_file = "help/#{lang.to_s.downcase}/wiki_syntax_common_mark.html" + # fall back to the english help page if there is none for the current + # language + unless Rails.public_path.join(help_file).readable? + help_file = "help/en/wiki_syntax_common_mark.html" + end + File.join(Redmine::Utils.relative_url_root, help_file) + end + def initial_page_content(page) "# #{@page.pretty_title}" end |