diff options
author | Go MAEDA <maeda@farend.jp> | 2023-12-06 14:26:57 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-12-06 14:26:57 +0000 |
commit | 7a06338a0442e411d5a34b1958a732755a4749d9 (patch) | |
tree | 78600deeccfbdf243d2f9efe149fb43b32d971c1 /lib/redmine/wiki_formatting | |
parent | b150a8e9b296275089030ea0430f6c098facccde (diff) | |
download | redmine-7a06338a0442e411d5a34b1958a732755a4749d9.tar.gz redmine-7a06338a0442e411d5a34b1958a732755a4749d9.zip |
Fix CommonMark Markdown help page to reflect user's language setting (#39755).
Patch by Go MAEDA.
git-svn-id: https://svn.redmine.org/redmine/trunk@22496 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting')
-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 |