]> source.dussan.org Git - redmine.git/commitdiff
Updates JS toolbar help button to use the new route (#39111, #40137).
authorMarius Balteanu <marius.balteanu@zitec.com>
Mon, 19 Feb 2024 20:58:13 +0000 (20:58 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Mon, 19 Feb 2024 20:58:13 +0000 (20:58 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22722 e93f8b46-1217-0410-a6f0-8f06a7374b81

config/routes.rb
lib/redmine/wiki_formatting/common_mark/helper.rb
lib/redmine/wiki_formatting/markdown/helper.rb
lib/redmine/wiki_formatting/textile/helper.rb

index 8e392fde517654003816ce3950f21888e736edaa..6965c8a8bb210c31ef9f292e3b7111b51cabeb34 100644 (file)
@@ -407,7 +407,7 @@ Rails.application.routes.draw do
 
   get 'robots.:format', :to => 'welcome#robots', :constraints => {:format => 'txt'}
 
-  match 'help/wiki_syntax/(:type)', :controller => 'help', :action => 'show_wiki_syntax', :via => :get, :constraints => { :type => /detailed/ }
+  get 'help/wiki_syntax/(:type)', :controller => 'help', :action => 'show_wiki_syntax', :constraints => { :type => /detailed/ }, as: 'help_wiki_syntax'
 
   Redmine::Plugin.directory.glob("*/config/routes.rb").sort.each do |plugin_routes_path|
     instance_eval(plugin_routes_path.read, plugin_routes_path.to_s)
index cfd2510edffb9dfb25c5e6cbadeb9399ba0cd6ef..3cf3208ff7180f285b9308a5c85b2adbcb7a4e21 100644 (file)
@@ -23,26 +23,15 @@ module Redmine
       module Helper
         def wikitoolbar_for(field_id, preview_url = preview_text_path)
           heads_for_wiki_formatter
-          url = help_path(current_language)
 
           javascript_tag(
             "var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); " \
-            "wikiToolbar.setHelpLink('#{escape_javascript url}'); " \
+            "wikiToolbar.setHelpLink('#{escape_javascript help_wiki_syntax_path }'); " \
             "wikiToolbar.setPreviewUrl('#{escape_javascript preview_url}'); " \
             "wikiToolbar.draw();"
           )
         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
index a3efbb04de43995934cbd605cc031d8be1ea0747..333671dd1637397b38f9b7088e40dcf43cddc606 100644 (file)
@@ -23,10 +23,10 @@ module Redmine
       module Helper
         def wikitoolbar_for(field_id, preview_url = preview_text_path)
           heads_for_wiki_formatter
-          url = "#{Redmine::Utils.relative_url_root}/help/#{current_language.to_s.downcase}/wiki_syntax_markdown.html"
+
           javascript_tag(
             "var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); " \
-              "wikiToolbar.setHelpLink('#{escape_javascript url}'); " \
+              "wikiToolbar.setHelpLink('#{escape_javascript help_wiki_syntax_path}'); " \
               "wikiToolbar.setPreviewUrl('#{escape_javascript preview_url}'); " \
               "wikiToolbar.draw();"
           )
index c4057673a570179071313172b66a20e3f9cb161f..3b00abe6d723cf600c57feef72a38b141591993d 100644 (file)
@@ -23,11 +23,10 @@ module Redmine
       module Helper
         def wikitoolbar_for(field_id, preview_url = preview_text_path)
           heads_for_wiki_formatter
-          # Is there a simple way to link to a public resource?
-          url = "#{Redmine::Utils.relative_url_root}/help/#{current_language.to_s.downcase}/wiki_syntax_textile.html"
+
           javascript_tag(
             "var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); " \
-              "wikiToolbar.setHelpLink('#{escape_javascript url}'); " \
+              "wikiToolbar.setHelpLink('#{escape_javascript help_wiki_syntax_path}'); " \
               "wikiToolbar.setPreviewUrl('#{escape_javascript preview_url}'); wikiToolbar.draw();"
           )
         end