Fixed wiki module.

This commit is contained in:
benni 2011-05-18 15:25:05 +02:00
parent d5552059ce
commit 772cf87c92
12 changed files with 25 additions and 43 deletions

View file

@ -96,21 +96,6 @@ class PagesController < ApplicationController
end
def all
@recent_pages = Page.non_redirected.all :order => 'updated_at DESC'
@pages = Page.non_redirected.all :order => 'title'
@top_pages = Page.no_parent.non_redirected.all :order => 'created_at'
view = params[:view]
params[:view] = nil
case view
when 'recentChanges'
render :partial => 'recent_changes' and return
when 'siteMap'
render :partial => 'site_map' and return
when 'titleList'
render :partial => 'title_list' and return
end
end
def version

View file

@ -2,14 +2,14 @@ module PagesHelper
include WikiCloth
def wikified_body(body, title = nil)
WikiCloth.new({:data => body+"\n", :link_handler => Wikilink.new, :params => {:referer => title}}).to_html
WikiCloth.new({:data => body+"\n", :link_handler => Wikilink.new, :params => {:referer => title}}).to_html.html_safe
end
def link_to_wikipage(page, text = nil)
if text == nil
link_to page.title, wiki_page_path(page.permalink)
link_to page.title, wiki_page_path(:permalink => page.permalink)
else
link_to text, wiki_page_path(page.permalink)
link_to text, wiki_page_path(:permalink => page.permalink)
end
end
@ -45,7 +45,7 @@ module PagesHelper
toc.gsub(/<li>([^<>\n]*)/) do
section_count += 1
"<li><a href='#section-#{section_count}'>#{$1}</a>"
end
end.html_safe
end
end

View file

@ -79,21 +79,14 @@
Siehe
= link_to "Tabellen", "http://www.mediawiki.org/wiki/Help:Tables", :target => '_blank'
- form_for @page do |f|
= f.error_messages
- simple_form_for @page do |f|
= f.hidden_field :lock_version
= f.input :title
= f.input :body, :input_html => {:size => "65x30"}
%p
%b Titel
%br/
= f.text_field :title
%p
%b Inhalt
%br/
= f.text_area :body, :size => "65x30"
%p
= f.submit "Vorschau", :name => 'preview'
= submit_tag "Vorschau", :name => 'preview'
|
= f.submit "Speichern"
= submit_tag "Speichern"
|
= link_to "Abbrechen", @page
| Oberseite ändern:

View file

@ -3,5 +3,5 @@
%tr
%th Titel
%th Zuletzt aktualisiert
- for page in @recent_pages
- for page in Page.non_redirected.order(:updated_at.desc)
= render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -6,6 +6,6 @@
- homepage = Page.find_by_permalink('Home')
- unless homepage.nil?
= render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1}
- for page in @top_pages
- for page in Page.no_parent.non_redirected.order(:created_at.desc)
- if page.id != homepage.id
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}

View file

@ -3,5 +3,5 @@
%tr
%th Titel
%th Zuletzt aktualisiert
- for page in @pages
- for page in Page.non_redirected.order(:title.desc)
= render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -14,8 +14,8 @@
.left_column{:style => "width:100%"}
.box_title
#editOrderNav
= remote_link_to 'Letzte Änderungen', :update => 'left_column', :url => {:action => 'all', :view => 'recentChanges'}
= remote_link_to 'Seiten-Liste', :update => 'left_column', :url => {:action => 'all', :view => 'titleList'}
= remote_link_to 'Site Map', :update => 'left_column', :url => {:action => 'all', :view => 'siteMap'}
= link_to 'Letzte Änderungen', all_pages_path(:view => 'recent_changes')
= link_to 'Seiten-Liste', all_pages_path(:view => 'title_list')
= link_to 'Site Map', all_pages_path(:view => 'site_map')
#left_column
= render :partial => 'recent_changes'
= render :partial => params[:view] || 'recent_changes'

View file

@ -16,9 +16,9 @@
#sidebar
#sidebar-links
= link_to "Bearbeiten", edit_page_path(@page)
= link_to_function "Versionen (#{@page.versions.count})", "Element.toggle('versions')"
= link_to "Versionen (#{@page.versions.count})", "#versions", 'data-toggle_this' => '#versions'
- unless @page.children.empty?
= link_to_function "Unterseiten", "Element.toggle('subpages')"
= link_to "Unterseiten", "#subpages", 'data-toggle_this' => '#subpages'
#versions{:style => "display:none"}
.box_title
%h2 Versionen

View file

@ -14,6 +14,7 @@ module Foodsoft
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths += %W(#{config.root}/lib)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.

View file

@ -206,6 +206,7 @@ de:
labels:
password: 'Passwort'
description: 'Beschreibung'
title: 'Titel'
workgroup:
weekly_task: 'Monatlichen Job definieren?'
weekday: 'Wochentag'
@ -227,6 +228,8 @@ de:
subject: 'Betreff'
body: 'Inhalt'
private: 'privat verschicken, Nachricht erscheint nicht im Foodsoft Posteingang'
page:
body: 'Inhalt'
hints:
task:
duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden'

View file

@ -30,7 +30,7 @@ Foodsoft::Application.routes.draw do
get :version, :on => :member
get :revert, :on => :member
end
match '/wiki/:permalink' => 'pages#show', :constraints => {:permalink => /[^\s]+/}, :as => 'wiki_page'
match '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
############ Orders, ordering

View file

@ -581,8 +581,8 @@ a.new_wiki_link {
color: grey; }
#breadcrump {
font-size: 0.5em;
margin-bottom: 5px;
font-size: 0.8em;
margin-bottom: 3px;
height: 1em;
color: #ED0606; }
#breadcrump a {