Added syntax help to wiki form.

This commit is contained in:
Benjamin Meichsner 2009-05-13 17:32:43 +02:00
parent 7e4409bc11
commit 0d11e68bad
3 changed files with 19 additions and 3 deletions

View file

@ -1,11 +1,12 @@
class Page < ActiveRecord::Base
validates_presence_of :title, :body
validates_uniqueness_of :permalink
before_save :set_permalink
before_validation_on_create :set_permalink
def set_permalink
if self.permalink.blank? #FIXME: or title.changed?
if self.permalink.blank?
self.permalink = Page.count == 0 ? "home" : "#{title.downcase.strip.gsub(/ |\.|@/, '-')}"
end
end

View file

@ -1,3 +1,18 @@
#wiki-syntax-help{:style => "float:right"}
%p
%b Schnelle Formatierungshilfe
%br/
:plain
[[interner Link]]<br />
[externer Link](http://addresse.net)<br />
*kursiv*<br />
**Fett**<br />
* erster Listenpunkt<br />
* zweiter Listenpunkt<br />
%p
Übersicht über alle Formatierungen:
= link_to "Markdown Cheatsheet", "http://packetlife.net/static/cheatsheets/markdown.pdf", :target => '_blank'
- form_for @page do |f|
= f.error_messages

View file

@ -4,7 +4,7 @@
%table
%tr
%th Title
%th Titel
%th zuletzt aktualisiert
- for page in @pages
%tr