Merge branch 'wiki'

Conflicts:
	app/helpers/pages_helper.rb
	public/stylesheets/main.css
	public/stylesheets/print.css
This commit is contained in:
Benjamin Meichsner 2009-09-28 15:04:07 +02:00
commit 529956ea5a
15 changed files with 381 additions and 180 deletions

View file

@ -60,6 +60,8 @@ class PagesController < ApplicationController
render :action => 'edit'
else
if @page.save
@page.parent_id = parent_id if (!params[:parent_id].blank? \
and params[:parent_id] != @page_id)
flash[:notice] = 'Seite wurde aktualisiert.'
redirect_to wiki_page_path(@page.permalink)
else
@ -83,7 +85,7 @@ class PagesController < ApplicationController
end
def all
@pages = Page.all :order => 'created_at', :conditions => {:redirect => nil}
@pages = Page.all :order => 'updated_at DESC', :conditions => {:redirect => nil}
end
def version

View file

@ -13,6 +13,10 @@ module ApplicationHelper
I18n.l(time) unless time.nil?
end
def format_datetime_timespec(time, format)
I18n.l(time, :format => format) unless (time.nil? or format.nil?)
end
# Creates ajax-controlled-links for pagination
# see also the plugin "will_paginate"
def pagination_links_remote(collection, options = {})

View file

@ -1,14 +1,6 @@
module PagesHelper
include WikiCloth
# def build_anchors(body)
# body.gsub(/(<h\d{1}>(.+)<\/h\d{1}>)/) do
# header = $1
# token = $2.downcase.gsub(' ', '-')
# "<a name='#{token}'> </a>#{header}"
# end
# end
def wikified_body(body, title = nil)
WikiCloth.new({:data => body+"\n", :link_handler => Wikilink.new, :params => {:referer => title}}).to_html
end
@ -36,22 +28,24 @@ module PagesHelper
end
end
end
# def generate_toc(body)
# toc = ""
# body.gsub(/^([=]{1,6})\s*(.*?)\s*(\1)/) do
# number = $1.length - 1
# name = $2
#
# toc << "#" * number + " #{name}\n"
# end
# toc = WikiCloth.new({:data => toc, :link_handler => Wikilink.new}).to_html
#
# toc.gsub(/<li>([^<>\n]*)/) do
# name = $1
# token = name.downcase.gsub(' ', '-')
#
# "<li><a href='##{token}'>#{name}</a>"
# end
# end
def generate_toc(body)
toc = String.new
body.gsub(/^([=]{1,6})\s*(.*?)\s*(\1)/) do
number = $1.length - 1
name = $2
toc << "*" * number + " #{name}\n"
end
logger.debug toc.inspect
unless toc.blank?
toc = WikiCloth.new({:data => toc, :link_handler => Wikilink.new}).to_html
section_count = 0
toc.gsub(/<li>([^<>\n]*)/) do
section_count += 1
"<li><a href='#section-#{section_count}'>#{$1}</a>"
end
end
end
end

View file

@ -10,7 +10,7 @@
= render :partial => "summary", :locals => {:order => @order}
- unless @order.stockit?
.left_column{:style => 'width: 24em'}
.middle_column{:style => 'width: 24em'}
.box_title
%h2 Rechnung
.column_content#invoice

View file

@ -1,5 +1,9 @@
- content = wikified_body @page.body, @page.title
//#toc
//%h2 Inhaltsverzeichnis
//= generate_toc @page.body
- toc = generate_toc @page.body
- unless toc.blank?
#wikitoc
%h2
Inhaltsverzeichnis
%span= link_to_function "[verstecken]", "Element.toggle('wikitoc-content')"
#wikitoc-content= toc
#wiki_content= content

View file

@ -3,7 +3,6 @@
#preview= render :partial => 'body'
#wiki-syntax-help
%p
.box_title
%h2 Schnelle Formatierungshilfe
.column_content
@ -54,9 +53,9 @@
Listen mit Zahlen
%td
%pre
1. Ersten Punkt
\# Ersten Punkt
%pre
1. Zweiter Punkt
\# Zweiter Punkt
%tr
%td(colspan=2)
%b Link-Formatierung
@ -83,7 +82,6 @@
- form_for @page do |f|
= f.error_messages
= f.hidden_field :lock_version
= f.hidden_field :parent_id
%p
%b Titel
%br/
@ -91,10 +89,14 @@
%p
%b Inhalt
%br/
= f.text_area :body, :size => "60x30"
= f.text_area :body, :size => "65x30"
%p
= f.submit "Vorschau", :name => 'preview'
|
= f.submit "Speichern"
|
= link_to "Abbrechen", @page
| Oberseite ändern:
= collection_select(:page, :parent_id, Page.all, :id, :permalink, {:prompt => "Neue Oberseite?"})
%div(style="clear:right; height:1px")

View file

@ -4,7 +4,7 @@
#breadcrump
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
%h1 Alle Wikiseite
%h1 Alle Wikiseiten
%p= link_to "Neue Seite anlegen", new_page_path
@ -15,4 +15,4 @@
- for page in @pages
%tr
%td= link_to page.title, wiki_page_path(page.permalink)
%td= format_date page.updated_at
%td= format_datetime page.updated_at

View file

@ -17,7 +17,12 @@
#page-versions
= link_to "Bearbeiten", edit_page_path(@page)
= link_to_function "Versionen (#{@page.versions.count})", "Element.toggle('versions')"
- unless @page.children.empty?
= link_to_function "Unterseiten", "Element.toggle('subpages')"
#versions{:style => "display:none"}
.box_title
%h2 Versionen
.column_content
%ul
- for version in @page.versions.reverse
%li
@ -25,8 +30,10 @@
= "(#{User.find(version.updated_by).nick})"
- unless @page.children.empty?
#subpages
#subpages{:style => "display:none"}
.box_title
%h2 Unterseiten
.column_content
%ul
- for page in @page.children
%li= link_to_wikipage(page)
@ -38,5 +45,7 @@
= link_to "Seite bearbeiten", edit_page_path(@page)
|
= link_to "Seite löschen", @page, :method => :delete, :confirm => "Achtung, auch alle Unterseiten werden gelöscht. Bist Du sicher?"
|
= "Zuletzt bearbeitet am #{format_datetime @page.updated_at} (#{@page.user.nick})"
| Zuletzt bearbeitet von
%b
= "#{@page.user.nick}"
= "am #{format_datetime @page.updated_at}"

View file

@ -13,11 +13,15 @@
= @page.title
#sidebar
%b= "Version vom #{format_datetime @version.updated_at}"
.box_title
%h2 Version
.column_content
%b= "#{format_datetime_timespec(@version.updated_at, "%a, %d.%m.%Y, %H:%M Uhr") }"
%ul
%li= "Autor: #{User.find(@version.updated_by).nick}"
%li= link_to "Aktuelle Version sehen", wiki_page_path(:permalink => @page.permalink)
%li= link_to "Auf diese Version zurücksetzen", revert_page_path(@page, :version => @version.lock_version)
= wikified_body @version.body
%div(style="clear:right")

View file

@ -146,7 +146,7 @@ span.click-me {
#main {
background: #FFF;
padding: 0;
margin: 0; }
margin: 0 15px 0 15px; }
#infobar {
width: 10%;
@ -205,10 +205,10 @@ span.click-me {
#content {
padding: .5em 0 2.5em 0;
margin: 0 0 0 1em;
margin: 0;
background: #FFF;
font-size: 1.3em;
width: 95%;
width: 100%;
float: left; }
/* *********************************** tables */
@ -311,9 +311,6 @@ div.box {
border-left: 2px solid #78b74e;
padding-left: 5px; }
div.single_column, div.left_column, div.right_column {
margin: .5em .5em 1.5em .5em; }
div.single_column {
width: 100%; }
@ -321,6 +318,11 @@ div.left_column {
width: 40%;
float: left; }
div.middle_column {
width: 40%;
margin-left: 10px;
float: left; }
div.right_column {
margin-bottom: 3em;
width: 55%;
@ -441,6 +443,7 @@ ul.autocomplete .informal {
top: -1em;
left: 5%; }
<<<<<<< HEAD:public/stylesheets/main.css
.stats-bar {
height: 20px;
min-width: 10px;
@ -452,6 +455,51 @@ ul.autocomplete .informal {
.wiki_show h1, .wiki_version h1, .wiki_new h1, .wiki_edit h1, .wiki_all h1 {
padding-left: 0;
padding-top: 10px; }
=======
#wiki_content {
border-style: none;
color: black;
line-height: 1.5em; }
.wiki_show, .wiki_version, .wiki_new, .wiki_edit, .wiki_all {
margin-top: 30px;
padding: 10px; }
.wiki_show h1, .wiki_version h1, .wiki_new h1, .wiki_edit h1, .wiki_all h1 {
padding-left: 0;
padding-top: 10px;
border-bottom-style: solid; }
.wiki_show .column_content, .wiki_version .column_content, .wiki_new .column_content, .wiki_edit .column_content, .wiki_all .column_content {
margin-bottom: 0; }
#wiki_content {
min-height: 400px; }
#wiki_content span.editsection {
display: none; }
#wiki_content h2, #wiki_content h3, #wiki_content h4, #wiki_content h5, #wiki_content h6 {
background: transparent none repeat scroll 0 0;
border-bottom: 1px solid #AAAAAA;
padding-bottom: 0,17em;
padding-top: 0,5em;
font-weight: normal;
font-size: 150%;
color: black; }
#wiki_content h3, #wiki_content h4, #wiki_content h5, #wiki_content h6 {
border-bottom: medium none;
font-weight: bold; }
#wiki_content h3 {
font-size: 132%; }
#wiki_content h4 {
font-size: 116%; }
#wiki_content ul {
line-height: 1.5em;
margin: 0.3em 0 0 1.5em;
padding: 0; }
#wiki_content ol {
line-height: 1.5em;
margin: 0.3em 0 0 3.2em;
padding: 0;
list-style-image: none; }
>>>>>>> wiki:public/stylesheets/main.css
a.new_wiki_link {
color: grey; }
@ -460,13 +508,22 @@ a.new_wiki_link {
border: 1px dotted grey;
padding: 0 1em; }
#toc {
float: right; }
#wikitoc {
padding: 5px;
margin-bottom: 2em;
width: 25em;
border: 1px solid grey;
background-color: #efefef; }
#wikitoc h2 {
font-size: 1em;
color: black; }
#wikitoc h2 span a {
font-size: 0.5em;
color: grey; }
#breadcrump {
font-size: 0.5em;
margin-bottom: 5px;
margin-top: 30px;
height: 1em;
color: #ED0606; }
#breadcrump a {
@ -477,19 +534,24 @@ a.new_wiki_link {
#sidebar {
float: right;
width: 20%; }
width: 290px;
margin-top: -60px; }
#sidebar #page-versions {
margin-top: -60px;
margin-bottom: 18px;
text-align: right; }
#sidebar #subpages {
margin-top: 2em; }
#wiki_content h1, #wiki_content h2, #wiki_content h3, #wiki_content h4, #wiki_content h5 {
color: black; }
#wiki_content span.editsection {
display: none; }
border: 1px solid #78b74e;
margin-top: 10px;
padding: 0 0 0 0; }
#sidebar #versions {
margin-top: 10px;
border: 1px solid #78b74e; }
#wiki-syntax-help {
float: right; }
#wiki-syntax-help table {
border-color: #78b74e; }
.wiki_version #sidebar {
margin-top: -23px;
border: 1px solid #78b74e; }

View file

@ -146,7 +146,7 @@ span.click-me {
#main {
background: #FFF;
padding: 0;
margin: 0; }
margin: 0 15px 0 15px; }
#infobar {
width: 10%;
@ -205,10 +205,10 @@ span.click-me {
#content {
padding: .5em 0 2.5em 0;
margin: 0 0 0 1em;
margin: 0;
background: #FFF;
font-size: 1.3em;
width: 95%;
width: 100%;
float: left; }
/* *********************************** tables */
@ -311,9 +311,6 @@ div.box {
border-left: 2px solid #78b74e;
padding-left: 5px; }
div.single_column, div.left_column, div.right_column {
margin: .5em .5em 1.5em .5em; }
div.single_column {
width: 100%; }
@ -321,6 +318,11 @@ div.left_column {
width: 40%;
float: left; }
div.middle_column {
width: 40%;
margin-left: 10px;
float: left; }
div.right_column {
margin-bottom: 3em;
width: 55%;
@ -441,6 +443,7 @@ ul.autocomplete .informal {
top: -1em;
left: 5%; }
<<<<<<< HEAD:public/stylesheets/print.css
.stats-bar {
height: 20px;
min-width: 10px;
@ -452,6 +455,51 @@ ul.autocomplete .informal {
.wiki_show h1, .wiki_version h1, .wiki_new h1, .wiki_edit h1, .wiki_all h1 {
padding-left: 0;
padding-top: 10px; }
=======
#wiki_content {
border-style: none;
color: black;
line-height: 1.5em; }
.wiki_show, .wiki_version, .wiki_new, .wiki_edit, .wiki_all {
margin-top: 30px;
padding: 10px; }
.wiki_show h1, .wiki_version h1, .wiki_new h1, .wiki_edit h1, .wiki_all h1 {
padding-left: 0;
padding-top: 10px;
border-bottom-style: solid; }
.wiki_show .column_content, .wiki_version .column_content, .wiki_new .column_content, .wiki_edit .column_content, .wiki_all .column_content {
margin-bottom: 0; }
#wiki_content {
min-height: 400px; }
#wiki_content span.editsection {
display: none; }
#wiki_content h2, #wiki_content h3, #wiki_content h4, #wiki_content h5, #wiki_content h6 {
background: transparent none repeat scroll 0 0;
border-bottom: 1px solid #AAAAAA;
padding-bottom: 0,17em;
padding-top: 0,5em;
font-weight: normal;
font-size: 150%;
color: black; }
#wiki_content h3, #wiki_content h4, #wiki_content h5, #wiki_content h6 {
border-bottom: medium none;
font-weight: bold; }
#wiki_content h3 {
font-size: 132%; }
#wiki_content h4 {
font-size: 116%; }
#wiki_content ul {
line-height: 1.5em;
margin: 0.3em 0 0 1.5em;
padding: 0; }
#wiki_content ol {
line-height: 1.5em;
margin: 0.3em 0 0 3.2em;
padding: 0;
list-style-image: none; }
>>>>>>> wiki:public/stylesheets/print.css
a.new_wiki_link {
color: grey; }
@ -460,13 +508,22 @@ a.new_wiki_link {
border: 1px dotted grey;
padding: 0 1em; }
#toc {
float: right; }
#wikitoc {
padding: 5px;
margin-bottom: 2em;
width: 25em;
border: 1px solid grey;
background-color: #efefef; }
#wikitoc h2 {
font-size: 1em;
color: black; }
#wikitoc h2 span a {
font-size: 0.5em;
color: grey; }
#breadcrump {
font-size: 0.5em;
margin-bottom: 5px;
margin-top: 30px;
height: 1em;
color: #ED0606; }
#breadcrump a {
@ -477,23 +534,28 @@ a.new_wiki_link {
#sidebar {
float: right;
width: 20%; }
width: 290px;
margin-top: -60px; }
#sidebar #page-versions {
margin-top: -60px;
margin-bottom: 18px;
text-align: right; }
#sidebar #subpages {
margin-top: 2em; }
#wiki_content h1, #wiki_content h2, #wiki_content h3, #wiki_content h4, #wiki_content h5 {
color: black; }
#wiki_content span.editsection {
display: none; }
border: 1px solid #78b74e;
margin-top: 10px;
padding: 0 0 0 0; }
#sidebar #versions {
margin-top: 10px;
border: 1px solid #78b74e; }
#wiki-syntax-help {
float: right; }
#wiki-syntax-help table {
border-color: #78b74e; }
.wiki_version #sidebar {
margin-top: -23px;
border: 1px solid #78b74e; }
#logininfo, #header, #footer {
display: none; }

View file

@ -162,7 +162,7 @@ span.click-me
#main
:background #FFF
:padding 0
:margin 0
:margin 0 15px 0 15px
// ************************************* infobar
#infobar
@ -226,10 +226,10 @@ span.click-me
// ************************************** content
#content
:padding .5em 0 2.5em 0
:margin 0 0 0 1em
:margin 0
:background #FFF
:font-size 1.3em
:width 95%
:width 100%
:float left
@ -342,9 +342,6 @@ div.box
:border-left 2px solid #78b74e
:padding-left 5px
div.single_column, div.left_column, div.right_column
:margin .5em .5em 1.5em .5em
div.single_column
:width 100%
@ -352,6 +349,11 @@ div.left_column
:width 40%
:float left
div.middle_column
:width 40%
:margin-left 10px
:float left
div.right_column
:margin-bottom 3em
:width 55%
@ -497,21 +499,73 @@ ul.autocomplete
text-align: center
margin: 0 10px 10px 0
// *** wiki
#wiki_content
border-style: none
color: black
line-height: 1.5em
.wiki_show, .wiki_version, .wiki_new, .wiki_edit, .wiki_all
margin-top: 30px
padding: 10px
h1
padding-left: 0
padding-top: 10px
border-bottom:
:style solid
.column_content
margin-bottom: 0
#wiki_content
min-height: 400px
span.editsection
display: none
h2, h3, h4, h5, h6
background: transparent none repeat scroll 0 0
border-bottom: 1px solid #AAAAAA
padding-bottom: 0,17em
padding-top: 0,5em
font-weight: normal
font-size: 150%
color: black
h3, h4, h5, h6
border-bottom: medium none
font-weight: bold
h3
font-size: 132%
h4
font-size: 116%
ul
line-height: 1.5em
margin: 0.3em 0 0 1.5em
padding: 0
ol
line-height: 1.5em
margin: 0.3em 0 0 3.2em
padding: 0
list-style-image: none
li margin-bottom: 0.1em
a.new_wiki_link
color: grey
#preview
border: 1px dotted grey
padding: 0 1em
#toc
float: right
#wikitoc
padding: 5px
margin-bottom: 2em
width: 25em
border: 1px solid grey
:background-color= !lightGrey
h2
font-size: 1em
color: black
span a
font-size: 0.5em
color: grey
#breadcrump
font-size: 0.5em
margin-bottom: 5px
margin-top: 30px
height: 1em
color: #ED0606
a
@ -521,21 +575,25 @@ a.new_wiki_link
:text-decoration = underline
#sidebar
float: right
width: 20%
#page-versions
width: 290px
margin-top: -60px
#page-versions
margin-bottom: 18px
text-align: right
#subpages
margin-top: 2em
#wiki_content
h1, h2, h3, h4, h5
color: black
span.editsection
display: none
border: 1px solid #78b74e
margin-top: 10px
padding: 0 0 0 0
#versions
margin-top: 10px
border: 1px solid #78b74e
#wiki-syntax-help
float: right
table
border-color: #78b74e
.wiki_version
#sidebar
margin-top: -23px
border: 1px solid #78b74e

View file

@ -127,7 +127,7 @@ class WikiBuffer
self.data.gsub!(/^([-]{4,})/) { |r| "<hr />" }
self.data.gsub!(/^([=]{1,6})\s*(.*?)\s*(\1)/) { |r|
@section_count += 1
"<h#{$1.length}>" + (@noeditsection == true ? "" :
"<a name='section-#{@section_count}' /><h#{$1.length}>" + (@noeditsection == true ? "" :
"<span class=\"editsection\">[<a href=\"" + @options[:link_handler].section_link(@section_count) +
"\" title=\"Edit section: #{$2}\">edit</a>]</span>") +
" <span class=\"mw-headline\">#{$2}</span></h#{$1.length}>"