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 end
def all 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 end
def version def version

View file

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

View file

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

View file

@ -3,5 +3,5 @@
%tr %tr
%th Titel %th Titel
%th Zuletzt aktualisiert %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} = render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -6,6 +6,6 @@
- homepage = Page.find_by_permalink('Home') - homepage = Page.find_by_permalink('Home')
- unless homepage.nil? - unless homepage.nil?
= render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1} = 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 - if page.id != homepage.id
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1} = render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}

View file

@ -3,5 +3,5 @@
%tr %tr
%th Titel %th Titel
%th Zuletzt aktualisiert %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} = render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

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

View file

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

View file

@ -14,6 +14,7 @@ module Foodsoft
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras) # 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). # 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. # :all can be used as a placeholder for all plugins not explicitly named.

View file

@ -206,6 +206,7 @@ de:
labels: labels:
password: 'Passwort' password: 'Passwort'
description: 'Beschreibung' description: 'Beschreibung'
title: 'Titel'
workgroup: workgroup:
weekly_task: 'Monatlichen Job definieren?' weekly_task: 'Monatlichen Job definieren?'
weekday: 'Wochentag' weekday: 'Wochentag'
@ -227,6 +228,8 @@ de:
subject: 'Betreff' subject: 'Betreff'
body: 'Inhalt' body: 'Inhalt'
private: 'privat verschicken, Nachricht erscheint nicht im Foodsoft Posteingang' private: 'privat verschicken, Nachricht erscheint nicht im Foodsoft Posteingang'
page:
body: 'Inhalt'
hints: hints:
task: task:
duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden' 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 :version, :on => :member
get :revert, :on => :member get :revert, :on => :member
end 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' match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
############ Orders, ordering ############ Orders, ordering

View file

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