Display wiki syntax quick ref link within the jstoolbar (closes #629, #767).

Added named links syntax on quick ref (closes #766, #778).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1190 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-03-05 11:14:35 +00:00
parent b0754ca720
commit c61424e57a
5 changed files with 28 additions and 9 deletions

View File

@ -444,9 +444,14 @@ module ApplicationHelper
def wikitoolbar_for(field_id) def wikitoolbar_for(field_id)
return '' unless Setting.text_formatting == 'textile' return '' unless Setting.text_formatting == 'textile'
help_link = l(:setting_text_formatting) + ': ' +
link_to(l(:label_help), compute_public_path('wiki_syntax', 'help', 'html'),
:onclick => "window.open(\"#{ compute_public_path('wiki_syntax', 'help', 'html') }\", \"\", \"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/jstoolbar') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language}") + javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language}") +
javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.draw();") javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.setHelpLink('#{help_link}'); toolbar.draw();")
end end
def content_for(name, content = nil, &block) def content_for(name, content = nil, &block)

View File

@ -3,11 +3,7 @@
<% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %> <% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %>
<%= f.hidden_field :version %> <%= f.hidden_field :version %>
<%= error_messages_for 'content' %> <%= error_messages_for 'content' %>
<div class="contextual">
<%= l(:setting_text_formatting) %>:
<%= link_to l(:label_help), compute_public_path('wiki_syntax', 'help', 'html'),
:onclick => "window.open('#{ compute_public_path('wiki_syntax', 'help', 'html') }', '', 'resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes'); return false;" %>
</div>
<p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %></p> <p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %></p>
<p><label><%= l(:field_comments) %></label><br /><%= f.text_field :comments, :size => 120 %></p> <p><label><%= l(:field_comments) %></label><br /><%= f.text_field :comments, :size => 120 %></p>
<p><%= submit_tag l(:button_save) %> <p><%= submit_tag l(:button_save) %>

View File

@ -4,10 +4,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Style-Type" content="text/css" />
<title>Wiki formatting</title> <title>Wiki formatting</title>
<link rel="stylesheet" href="html.css" type="text/css" />
<style type="text/css"> <style type="text/css">
h1 { font-family: Verdana, sans-serif; font-size: 14px; text-align: center; color: #444; } h1 { font-family: Verdana, sans-serif; font-size: 14px; text-align: center; color: #444; }
table { font-family: Verdana, sans-serif; font-size: 12px; color: #444; } body { font-family: Verdana, sans-serif; font-size: 12px; color: #444; }
table th { padding-top: 1em; }
table td { vertical-align: top; background-color: #f5f5f5; height: 2em; vertical-align: middle;} table td { vertical-align: top; background-color: #f5f5f5; height: 2em; vertical-align: middle;}
table td code { font-size: 1.2em; } table td code { font-size: 1.2em; }
table td h1 { font-size: 1.8em; text-align: left; } table td h1 { font-size: 1.8em; text-align: left; }
@ -46,6 +46,9 @@ table td h3 { font-size: 1.2em; text-align: left; }
<tr><th colspan="3">Links</th></tr> <tr><th colspan="3">Links</th></tr>
<tr><th></th><td>http://foo.bar</td><td><a href="#">http://foo.bar</a></td></tr> <tr><th></th><td>http://foo.bar</td><td><a href="#">http://foo.bar</a></td></tr>
<tr><th></th><td>"Foo":http://foo.bar</td><td><a href="#">Foo</a></td></tr>
<tr><th colspan="3">Redmine links</th></tr>
<tr><th><img src="../../images/jstoolbar/bt_link.png" style="border: 1px solid #bbb;" alt="Link to a Wiki page" /></th><td>[[Wiki page]]</td><td><a href="#">Wiki page</a></td></tr> <tr><th><img src="../../images/jstoolbar/bt_link.png" style="border: 1px solid #bbb;" alt="Link to a Wiki page" /></th><td>[[Wiki page]]</td><td><a href="#">Wiki page</a></td></tr>
<tr><th></th><td>Issue #12</td><td>Issue <a href="#">#12</a></td></tr> <tr><th></th><td>Issue #12</td><td>Issue <a href="#">#12</a></td></tr>
<tr><th></th><td>Revision r43</td><td>Revision <a href="#">r43</a></td></tr> <tr><th></th><td>Revision r43</td><td>Revision <a href="#">r43</a></td></tr>
@ -55,5 +58,7 @@ table td h3 { font-size: 1.2em; text-align: left; }
<tr><th></th><td>!<em>attached_image</em>!</td><td></td></tr> <tr><th></th><td>!<em>attached_image</em>!</td><td></td></tr>
</table> </table>
<p><a href="http://www.redmine.org/wiki/redmine/RedmineWikiFormatting" onclick="window.open('http://www.redmine.org/wiki/redmine/RedmineWikiFormatting', '', ''); return false;">More Information</a></p>
</body> </body>
</html> </html>

View File

@ -151,6 +151,7 @@ jsToolBar.prototype = {
base_url: '', base_url: '',
mode: 'wiki', mode: 'wiki',
elements: {}, elements: {},
help_link: '',
getMode: function() { getMode: function() {
return this.mode; return this.mode;
@ -165,6 +166,10 @@ jsToolBar.prototype = {
this.draw(mode); this.draw(mode);
}, },
setHelpLink: function(link) {
this.help_link = link;
},
button: function(toolName) { button: function(toolName) {
var tool = this.elements[toolName]; var tool = this.elements[toolName];
if (typeof tool.fn[this.mode] != 'function') return null; if (typeof tool.fn[this.mode] != 'function') return null;
@ -202,6 +207,12 @@ jsToolBar.prototype = {
} }
this.toolNodes = {}; // vide les raccourcis DOM/**/ this.toolNodes = {}; // vide les raccourcis DOM/**/
var h = document.createElement('div');
h.className = 'help'
h.innerHTML = this.help_link;
'<a href="/help/wiki_syntax.html" onclick="window.open(\'/help/wiki_syntax.html\', \'\', \'resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\'); return false;">Aide</a>';
this.toolbar.appendChild(h);
// Draw toolbar elements // Draw toolbar elements
var b, tool, newTool; var b, tool, newTool;

View File

@ -44,6 +44,8 @@
margin-right: 4px; margin-right: 4px;
} }
.jstElements .help { float: right; margin-right: 1em; padding-top: 8px; font-size: 0.9em; }
/* Buttons /* Buttons
-------------------------------------------------------- */ -------------------------------------------------------- */
.jstb_strong { .jstb_strong {