2008-10-27 14:08:29 +03:00
|
|
|
# Redmine - project management software
|
2012-05-05 16:56:53 +04:00
|
|
|
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
2008-10-27 14:08:29 +03:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-09-01 06:03:23 +04:00
|
|
|
#
|
2008-10-27 14:08:29 +03:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2011-09-01 06:03:23 +04:00
|
|
|
#
|
2008-10-27 14:08:29 +03:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
module Redmine
|
|
|
|
module WikiFormatting
|
|
|
|
module Textile
|
|
|
|
module Helper
|
|
|
|
def wikitoolbar_for(field_id)
|
2011-03-28 23:59:35 +04:00
|
|
|
heads_for_wiki_formatter
|
2009-01-04 15:50:45 +03:00
|
|
|
# Is there a simple way to link to a public resource?
|
2009-01-04 20:09:25 +03:00
|
|
|
url = "#{Redmine::Utils.relative_url_root}/help/wiki_syntax.html"
|
2011-03-29 00:12:15 +04:00
|
|
|
help_link = link_to(l(:setting_text_formatting), url,
|
|
|
|
:onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")
|
2011-09-01 06:03:23 +04:00
|
|
|
|
2011-03-29 00:16:05 +04:00
|
|
|
javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript help_link}'); wikiToolbar.draw();")
|
2008-10-27 14:08:29 +03:00
|
|
|
end
|
2011-09-01 06:03:23 +04:00
|
|
|
|
2008-10-27 14:08:29 +03:00
|
|
|
def initial_page_content(page)
|
|
|
|
"h1. #{@page.pretty_title}"
|
|
|
|
end
|
2011-09-01 06:03:23 +04:00
|
|
|
|
2008-10-27 14:08:29 +03:00
|
|
|
def heads_for_wiki_formatter
|
2011-03-28 23:59:35 +04:00
|
|
|
unless @heads_for_wiki_formatter_included
|
|
|
|
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}") +
|
|
|
|
stylesheet_link_tag('jstoolbar')
|
|
|
|
end
|
|
|
|
@heads_for_wiki_formatter_included = true
|
|
|
|
end
|
2008-10-27 14:08:29 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|