summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-01-14 14:38:48 +0000
committerGo MAEDA <maeda@farend.jp>2020-01-14 14:38:48 +0000
commit6611f5bf5dd78d5c7ba9b11eafc498049e05fa52 (patch)
tree499425f933124e0342055ecd70d01343959313bf /lib
parent7f60d56201e479be4f1235e873e1119e493679ad (diff)
downloadredmine-6611f5bf5dd78d5c7ba9b11eafc498049e05fa52.tar.gz
redmine-6611f5bf5dd78d5c7ba9b11eafc498049e05fa52.zip
Make languages in Highlighted code button in toolbar customizable (#32528).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@19429 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/wiki_formatting/markdown/helper.rb4
-rw-r--r--lib/redmine/wiki_formatting/textile/helper.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/redmine/wiki_formatting/markdown/helper.rb b/lib/redmine/wiki_formatting/markdown/helper.rb
index 6b5a1dfc3..aafa90e3c 100644
--- a/lib/redmine/wiki_formatting/markdown/helper.rb
+++ b/lib/redmine/wiki_formatting/markdown/helper.rb
@@ -33,11 +33,13 @@ module Redmine
def heads_for_wiki_formatter
unless @heads_for_wiki_formatter_included
+ toolbar_language_options = User.current && User.current.pref.toolbar_language_options
content_for :header_tags do
javascript_include_tag('jstoolbar/jstoolbar') +
javascript_include_tag('jstoolbar/markdown') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
- javascript_tag("var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};") +
+ javascript_tag("var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};" +
+ "var userHlLanguages = #{(toolbar_language_options.nil? ? UserPreference::DEFAULT_TOOLBAR_LANGUAGE_OPTIONS : toolbar_language_options.split(',')).to_json};") +
stylesheet_link_tag('jstoolbar')
end
@heads_for_wiki_formatter_included = true
diff --git a/lib/redmine/wiki_formatting/textile/helper.rb b/lib/redmine/wiki_formatting/textile/helper.rb
index e3865fca5..9b45fd388 100644
--- a/lib/redmine/wiki_formatting/textile/helper.rb
+++ b/lib/redmine/wiki_formatting/textile/helper.rb
@@ -34,11 +34,13 @@ module Redmine
def heads_for_wiki_formatter
unless @heads_for_wiki_formatter_included
+ toolbar_language_options = User.current && User.current.pref.toolbar_language_options
content_for :header_tags do
javascript_include_tag('jstoolbar/jstoolbar') +
javascript_include_tag('jstoolbar/textile') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
- javascript_tag("var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};") +
+ javascript_tag("var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};" +
+ "var userHlLanguages = #{(toolbar_language_options.nil? ? UserPreference::DEFAULT_TOOLBAR_LANGUAGE_OPTIONS : toolbar_language_options.split(',')).to_json};") +
stylesheet_link_tag('jstoolbar')
end
@heads_for_wiki_formatter_included = true