summaryrefslogtreecommitdiffstats
path: root/lib/redmine
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-10 13:33:52 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-10 13:33:52 +0000
commit3e454980053546a7d17c04769f2250ac78abbf99 (patch)
treea96b2cab04ef1150e4b1986e008cb05801561329 /lib/redmine
parentc840cefb76f5d11dcf526b1d8f68c2b11064517a (diff)
downloadredmine-3e454980053546a7d17c04769f2250ac78abbf99.tar.gz
redmine-3e454980053546a7d17c04769f2250ac78abbf99.zip
shorten long line of lib/redmine/wiki_formatting/markdown/helper.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20608 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r--lib/redmine/wiki_formatting/markdown/helper.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/redmine/wiki_formatting/markdown/helper.rb b/lib/redmine/wiki_formatting/markdown/helper.rb
index 55424d644..d62e2a111 100644
--- a/lib/redmine/wiki_formatting/markdown/helper.rb
+++ b/lib/redmine/wiki_formatting/markdown/helper.rb
@@ -24,7 +24,12 @@ module Redmine
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.setPreviewUrl('#{escape_javascript preview_url}'); wikiToolbar.draw();")
+ javascript_tag(
+ "var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); " \
+ "wikiToolbar.setHelpLink('#{escape_javascript url}'); " \
+ "wikiToolbar.setPreviewUrl('#{escape_javascript preview_url}'); " \
+ "wikiToolbar.draw();"
+ )
end
def initial_page_content(page)
@@ -34,12 +39,20 @@ module Redmine
def heads_for_wiki_formatter
unless @heads_for_wiki_formatter_included
toolbar_language_options = User.current && User.current.pref.toolbar_language_options
+ lang =
+ if toolbar_language_options.nil?
+ UserPreference::DEFAULT_TOOLBAR_LANGUAGE_OPTIONS
+ else
+ toolbar_language_options.split(',')
+ end
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};" +
- "var userHlLanguages = #{(toolbar_language_options.nil? ? UserPreference::DEFAULT_TOOLBAR_LANGUAGE_OPTIONS : toolbar_language_options.split(',')).to_json};") +
+ javascript_tag(
+ "var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};" \
+ "var userHlLanguages = #{lang.to_json};"
+ ) +
stylesheet_link_tag('jstoolbar')
end
@heads_for_wiki_formatter_included = true