##// END OF EJS Templates
Moves jstoolbar script include tags to head....
Jean-Philippe Lang -
r5118:70d765e906a5
parent child
Show More
@@ -1,46 +1,47
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2008 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module Redmine
19 19 module WikiFormatting
20 20 module Textile
21 21 module Helper
22 22 def wikitoolbar_for(field_id)
23 23 # Is there a simple way to link to a public resource?
24 24 url = "#{Redmine::Utils.relative_url_root}/help/wiki_syntax.html"
25 25
26 26 help_link = l(:setting_text_formatting) + ': ' +
27 27 link_to(l(:label_help), url,
28 28 :onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")
29 29
30 javascript_include_tag('jstoolbar/jstoolbar') +
31 javascript_include_tag('jstoolbar/textile') +
32 javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
33 30 javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{help_link}'); wikiToolbar.draw();")
34 31 end
35 32
36 33 def initial_page_content(page)
37 34 "h1. #{@page.pretty_title}"
38 35 end
39 36
40 37 def heads_for_wiki_formatter
41 stylesheet_link_tag 'jstoolbar'
38 @@heads_for_wiki_formatter ||=
39 javascript_include_tag('jstoolbar/jstoolbar') +
40 javascript_include_tag('jstoolbar/textile') +
41 javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
42 stylesheet_link_tag('jstoolbar')
42 43 end
43 44 end
44 45 end
45 46 end
46 47 end
@@ -1,40 +1,49
1 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 3 class LayoutTest < ActionController::IntegrationTest
4 4 fixtures :all
5 5
6 6 test "browsing to a missing page should render the base layout" do
7 7 get "/users/100000000"
8 8
9 9 assert_response :not_found
10 10
11 11 # UsersController uses the admin layout by default
12 12 assert_select "#admin-menu", :count => 0
13 13 end
14 14
15 15 test "browsing to an unauthorized page should render the base layout" do
16 16 change_user_password('miscuser9', 'test')
17 17
18 18 log_user('miscuser9','test')
19 19
20 20 get "/admin"
21 21 assert_response :forbidden
22 22 assert_select "#admin-menu", :count => 0
23 23 end
24 24
25 25 def test_top_menu_and_search_not_visible_when_login_required
26 26 with_settings :login_required => '1' do
27 27 get '/'
28 28 assert_select "#top-menu > ul", 0
29 29 assert_select "#quick-search", 0
30 30 end
31 31 end
32 32
33 33 def test_top_menu_and_search_visible_when_login_not_required
34 34 with_settings :login_required => '0' do
35 35 get '/'
36 36 assert_select "#top-menu > ul"
37 37 assert_select "#quick-search"
38 38 end
39 39 end
40
41 def test_wiki_formatter_header_tags
42 Role.anonymous.add_permission! :add_issues
43
44 get '/projects/ecookbook/issues/new'
45 assert_tag :script,
46 :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}},
47 :parent => {:tag => 'head'}
48 end
40 49 end
General Comments 0
You need to be logged in to leave comments. Login now