From 70d765e906a50e672ab4534882db6f85abf7cc4c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 28 Mar 2011 19:56:22 +0000 Subject: [PATCH] Moves jstoolbar script include tags to head. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5238 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/wiki_formatting/textile/helper.rb | 9 +++++---- test/integration/layout_test.rb | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/redmine/wiki_formatting/textile/helper.rb b/lib/redmine/wiki_formatting/textile/helper.rb index 77cb90c67..d6d779af9 100644 --- a/lib/redmine/wiki_formatting/textile/helper.rb +++ b/lib/redmine/wiki_formatting/textile/helper.rb @@ -27,9 +27,6 @@ module Redmine link_to(l(:label_help), url, :onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;") - javascript_include_tag('jstoolbar/jstoolbar') + - javascript_include_tag('jstoolbar/textile') + - javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") + javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{help_link}'); wikiToolbar.draw();") end @@ -38,7 +35,11 @@ module Redmine end def heads_for_wiki_formatter - stylesheet_link_tag 'jstoolbar' + @@heads_for_wiki_formatter ||= + javascript_include_tag('jstoolbar/jstoolbar') + + javascript_include_tag('jstoolbar/textile') + + javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") + + stylesheet_link_tag('jstoolbar') end end end diff --git a/test/integration/layout_test.rb b/test/integration/layout_test.rb index 4e6f3d4d4..dc406871e 100644 --- a/test/integration/layout_test.rb +++ b/test/integration/layout_test.rb @@ -37,4 +37,13 @@ class LayoutTest < ActionController::IntegrationTest assert_select "#quick-search" end end + + def test_wiki_formatter_header_tags + Role.anonymous.add_permission! :add_issues + + get '/projects/ecookbook/issues/new' + assert_tag :script, + :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}}, + :parent => {:tag => 'head'} + end end