2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2012-01-03 23:36:40 +04:00
|
|
|
# Copyright (C) 2010-2012 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04: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-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
|
|
|
|
2008-10-27 14:08:29 +03:00
|
|
|
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
|
2011-05-02 14:18:31 +04:00
|
|
|
url = url_for(:controller => 'help', :action => 'wiki_syntax')
|
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;",
|
|
|
|
:tabindex => -1)
|
2011-05-30 22:52:25 +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-05-30 22:52:25 +04:00
|
|
|
|
2008-10-27 14:08:29 +03:00
|
|
|
def initial_page_content(page)
|
|
|
|
"h1. #{@page.pretty_title}"
|
|
|
|
end
|
2011-05-30 22:52:25 +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
|