* added "Heading" and "Inline quote" buttons to the toolbar
* changed "Link" button behaviour (now produces [[Link]])
* added a simple help on text formatting

git-svn-id: http://redmine.rubyforge.org/svn/trunk@327 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-03-11 14:00:15 +00:00
parent 5b135c07d0
commit a54a15523b
8 changed files with 112 additions and 10 deletions

View File

@ -6,7 +6,12 @@
<% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %>
<%= error_messages_for 'content' %>
<p><%= f.text_area :text, :cols => 100, :rows => 25, :style => "width:99%;" %></p>
<div class="contextual">
<%= l(:setting_text_formatting) %>:
<%= link_to l(:label_help), {:controller => 'help', :ctrl => 'wiki', :page => 'syntax' },
:onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %>
</div>
<p><%= f.text_area :text, :cols => 100, :rows => 25, :style => "width:99.5%;" %></p>
<p><label><%= l(:field_comment) %></label><br /><%= f.text_field :comment, :size => 120 %></p>
<p><%= submit_tag l(:button_save) %>
<%= link_to_remote l(:label_preview),

View File

@ -74,3 +74,5 @@ pages:
index: ch03.html
lost_password: ch03s03.html
register: ch03s04.html
wiki:
syntax: wiki_syntax.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

View File

@ -346,13 +346,13 @@ jsToolBar.prototype.elements.del = {
}
// quote
//jsToolBar.prototype.elements.quote = {
// type: 'button',
// title: 'Inline quote',
// fn: {
// wiki: function() { this.singleTag('{{','}}') }
// }
//}
jsToolBar.prototype.elements.quote = {
type: 'button',
title: 'Inline quote',
fn: {
wiki: function() { this.singleTag('??') }
}
}
// code
jsToolBar.prototype.elements.code = {
@ -364,7 +364,21 @@ jsToolBar.prototype.elements.code = {
}
// spacer
//jsToolBar.prototype.elements.space1 = {type: 'space'}
jsToolBar.prototype.elements.space1 = {type: 'space'}
// heading
jsToolBar.prototype.elements.heading = {
type: 'button',
title: 'Heading',
fn: {
wiki: function() {
this.encloseSelection('','',function(str) {
str = str.replace(/\r/g,'');
return 'h2. '+str.replace(/\n/g,"\n* ");
});
}
}
}
// br
//jsToolBar.prototype.elements.br = {
@ -410,6 +424,7 @@ jsToolBar.prototype.elements.ol = {
jsToolBar.prototype.elements.space3 = {type: 'space'}
// link
/*
jsToolBar.prototype.elements.link = {
type: 'button',
title: 'Link',
@ -438,3 +453,12 @@ jsToolBar.prototype.elements.link.fn.wiki = function() {
this.encloseSelection(stag,etag);
}
};
*/
// link or wiki page
jsToolBar.prototype.elements.link = {
type: 'button',
title: 'Link',
fn: {
wiki: function() { this.encloseSelection("[[", "]]") }
}
}

View File

@ -0,0 +1,32 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Wiki formatting</title>
<link rel="stylesheet" href="html.css" type="text/css">
<style>
table td { vertical-align: top; background-color: #eee; }
table td code { font-size: 1.2em; }
</style>
</head>
<body>
<table width="100%">
<tr><th colspan="3"><p><strong>Font Styles</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_strong.png" style="border: 1px solid #bbb;" /></th><td>*Strong*</td><td><strong>Strong</strong></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_em.png" style="border: 1px solid #bbb;" /></th><td>_Italic_</td><td><em>Italic</em></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_ins.png" style="border: 1px solid #bbb;" /></th><td>+Underline+</td><td><ins>Underline</ins></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_del.png" style="border: 1px solid #bbb;" /></th><td>-Deleted-</td><td><del>Deleted</del></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_quote.png" style="border: 1px solid #bbb;" /></th><td>??Quote??</td><td><cite>Quote</cite></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_code.png" style="border: 1px solid #bbb;" /></th><td>@Code@</td><td><code>Code</code></td></tr>
<tr><th colspan="3"><p><strong>Lists</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_ul.png" style="border: 1px solid #bbb;" /></th><td>* Item 1<br />* Item 2</td><td><ul><li>Item 1</li><li>Item 2</li></ul></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_ol.png" style="border: 1px solid #bbb;" /></th><td># Item 1<br /># Item 2</td><td><ol><li>Item 1</li><li>Item 2</li></ol></td></tr>
<tr><th colspan="3"><p><strong>Titles</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_heading.png" style="border: 1px solid #bbb;" /></th><td>h2. Title 2</td><td><h2>Title 2</h2></td></tr>
<tr><th colspan="3"><p><strong>Links</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_link.png" style="border: 1px solid #bbb;" /></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>Revision r43</td><td>Revision <a href="#">r43</a></td></tr></table>
</body>
</html>

View File

@ -0,0 +1,32 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Formatage Wiki</title>
<link rel="stylesheet" href="html.css" type="text/css">
<style>
table td { vertical-align: top; background-color: #eee; }
table td code { font-size: 1.2em; }
</style>
</head>
<body>
<table width="100%">
<tr><th colspan="3"><p><strong>Mise en forme</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_strong.png" style="border: 1px solid #bbb;" /></th><td>*Gras*</td><td><strong>Gras</strong></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_em.png" style="border: 1px solid #bbb;" /></th><td>_Italique_</td><td><em>Italique</em></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_ins.png" style="border: 1px solid #bbb;" /></th><td>+Souligné+</td><td><ins>Souligné</ins></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_del.png" style="border: 1px solid #bbb;" /></th><td>-Rayé-</td><td><del>Rayé</del></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_quote.png" style="border: 1px solid #bbb;" /></th><td>??Citation??</td><td><cite>Citation</cite></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_code.png" style="border: 1px solid #bbb;" /></th><td>@Code@</td><td><code>Code</code></td></tr>
<tr><th colspan="3"><p><strong>Listes</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_ul.png" style="border: 1px solid #bbb;" /></th><td>* Item 1<br />* Item 2</td><td><ul><li>Item 1</li><li>Item 2</li></ul></td></tr>
<tr><th><img src="../../images/jstoolbar/bt_ol.png" style="border: 1px solid #bbb;" /></th><td># Item 1<br /># Item 2</td><td><ol><li>Item 1</li><li>Item 2</li></ol></td></tr>
<tr><th colspan="3"><p><strong>Titres</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_heading.png" style="border: 1px solid #bbb;" /></th><td>h2. Titre 2</td><td><h2>Titre 2</h2></td></tr>
<tr><th colspan="3"><p><strong>Liens</strong></p></th></tr>
<tr><th><img src="../../images/jstoolbar/bt_link.png" style="border: 1px solid #bbb;" /></th><td>[[Page wiki]]</td><td><a href="#">Page wiki</a></td></tr>
<tr><th></th><td>Demande #12</td><td>Demande <a href="#">#12</a></td></tr>
<tr><th></th><td>Révision r43</td><td>Révision <a href="#">r43</a></td></tr></table>
</body>
</html>

View File

@ -599,4 +599,8 @@ div.wiki table, div.wiki td {
padding: 4px;
}
div.wiki code {
font-size: 1.2em;
}
#preview .preview { background: #fafbfc url(../images/draft.png); }

View File

@ -67,6 +67,9 @@
.jstb_br {
background-image: url(../images/jstoolbar/bt_br.png);
}
.jstb_heading {
background-image: url(../images/jstoolbar/bt_heading.png);
}
.jstb_ul {
background-image: url(../images/jstoolbar/bt_ul.png);
}