comparison lib/redmine/wiki_formatting/textile/.svn/text-base/helper.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 513646585e45
children
comparison
equal deleted inserted replaced
245:051f544170fe 441:cbce1fd3b1b7
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
18 module Redmine 18 module Redmine
19 module WikiFormatting 19 module WikiFormatting
20 module Textile 20 module Textile
21 module Helper 21 module Helper
22 def wikitoolbar_for(field_id) 22 def wikitoolbar_for(field_id)
23 heads_for_wiki_formatter
23 # Is there a simple way to link to a public resource? 24 # Is there a simple way to link to a public resource?
24 url = "#{Redmine::Utils.relative_url_root}/help/wiki_syntax.html" 25 url = "#{Redmine::Utils.relative_url_root}/help/wiki_syntax.html"
25 26 help_link = link_to(l(:setting_text_formatting), url,
26 help_link = l(:setting_text_formatting) + ': ' + 27 :onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")
27 link_to(l(:label_help), url,
28 :onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")
29 28
30 javascript_include_tag('jstoolbar/jstoolbar') + 29 javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript help_link}'); wikiToolbar.draw();")
31 javascript_include_tag('jstoolbar/textile') +
32 javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
33 javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{help_link}'); wikiToolbar.draw();")
34 end 30 end
35 31
36 def initial_page_content(page) 32 def initial_page_content(page)
37 "h1. #{@page.pretty_title}" 33 "h1. #{@page.pretty_title}"
38 end 34 end
39 35
40 def heads_for_wiki_formatter 36 def heads_for_wiki_formatter
41 stylesheet_link_tag 'jstoolbar' 37 unless @heads_for_wiki_formatter_included
38 content_for :header_tags do
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')
43 end
44 @heads_for_wiki_formatter_included = true
45 end
42 end 46 end
43 end 47 end
44 end 48 end
45 end 49 end
46 end 50 end