Redirect /pages/id to /wiki/permalink

This commit is contained in:
Benjamin Meichsner 2009-09-28 15:31:20 +02:00
parent eca24d30f2
commit 7c192bbad3
6 changed files with 18 additions and 18 deletions

View file

@ -11,7 +11,17 @@ class PagesController < ApplicationController
end
def show
@page = Page.find_by_permalink(params[:permalink])
if params[:permalink]
@page = Page.find_by_permalink(params[:permalink])
elsif params[:id]
page = Page.find_by_id(params[:id])
if page.nil?
flash[:error] = "Seite existiert nicht!"
redirect_to all_pages_path and return
else
redirect_to wiki_page_path(page.permalink) and return
end
end
if @page.nil?
redirect_to new_page_path(:title => params[:permalink])

View file

@ -6,7 +6,9 @@
%h1 Alle Wikiseiten
%p= link_to "Neue Seite anlegen", new_page_path
#sidebar
#sidebar-links= link_to "Neue Seite anlegen", new_page_path
%table
%tr

View file

@ -14,7 +14,7 @@
= @page.title
#sidebar
#page-versions
#sidebar-links
= link_to "Bearbeiten", edit_page_path(@page)
= link_to_function "Versionen (#{@page.versions.count})", "Element.toggle('versions')"
- unless @page.children.empty?

View file

@ -443,7 +443,6 @@ ul.autocomplete .informal {
top: -1em;
left: 5%; }
<<<<<<< HEAD:public/stylesheets/main.css
.stats-bar {
height: 20px;
min-width: 10px;
@ -452,10 +451,6 @@ ul.autocomplete .informal {
text-align: center;
margin: 0 10px 10px 0; }
.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;
@ -499,7 +494,6 @@ ul.autocomplete .informal {
margin: 0.3em 0 0 3.2em;
padding: 0;
list-style-image: none; }
>>>>>>> wiki:public/stylesheets/main.css
a.new_wiki_link {
color: grey; }
@ -536,7 +530,7 @@ a.new_wiki_link {
float: right;
width: 290px;
margin-top: -60px; }
#sidebar #page-versions {
#sidebar #sidebar-links {
margin-bottom: 18px;
text-align: right; }
#sidebar #subpages {

View file

@ -443,7 +443,6 @@ ul.autocomplete .informal {
top: -1em;
left: 5%; }
<<<<<<< HEAD:public/stylesheets/print.css
.stats-bar {
height: 20px;
min-width: 10px;
@ -452,10 +451,6 @@ ul.autocomplete .informal {
text-align: center;
margin: 0 10px 10px 0; }
.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;
@ -499,7 +494,6 @@ ul.autocomplete .informal {
margin: 0.3em 0 0 3.2em;
padding: 0;
list-style-image: none; }
>>>>>>> wiki:public/stylesheets/print.css
a.new_wiki_link {
color: grey; }
@ -536,7 +530,7 @@ a.new_wiki_link {
float: right;
width: 290px;
margin-top: -60px; }
#sidebar #page-versions {
#sidebar #sidebar-links {
margin-bottom: 18px;
text-align: right; }
#sidebar #subpages {

View file

@ -577,7 +577,7 @@ a.new_wiki_link
float: right
width: 290px
margin-top: -60px
#page-versions
#sidebar-links
margin-bottom: 18px
text-align: right
#subpages