Added site map and titel list to pages/all

* pages/all now consists of three alternativ views: recent changes, site map and title list
This commit is contained in:
sandoz 2009-10-05 17:25:19 +02:00
parent 305a4ac895
commit 90f760858e
7 changed files with 58 additions and 10 deletions

View file

@ -96,7 +96,21 @@ class PagesController < ApplicationController
end end
def all def all
@pages = Page.non_redirected.all :order => 'updated_at DESC' @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

@ -31,6 +31,7 @@ class Page < ActiveRecord::Base
after_update :create_redirect after_update :create_redirect
named_scope :non_redirected, :conditions => {:redirect => nil} named_scope :non_redirected, :conditions => {:redirect => nil}
named_scope :no_parent, :conditions => {:parent_id => nil}
def self.permalink(title) def self.permalink(title)
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "") title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")

View file

@ -0,0 +1,8 @@
-ident = 20 * level
%tr
%td{:style => "padding-left: #{ident}px"}
= link_to page.title, wiki_page_path(page.permalink)
%td= "#{User.find(page.updated_by).nick} (#{format_datetime_timespec(page.updated_at, '%a, %d. %B %Y %H:%M:%S')})"
-if siteMap == 1
-for child in page.children.all
= render :partial => 'page_list_item', :locals => {:page => child, :level => level+1, :siteMap => 1}

View file

@ -0,0 +1,7 @@
.column_content
%table
%tr
%th Titel
%th Zuletzt aktualisiert
- for page in @recent_pages
= render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -0,0 +1,10 @@
.column_content
%table
%tr
%th Titel
%th Zuletzt aktualisiert
- homepage = Page.find_by_permalink('Home')
= render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1}
- for page in @top_pages
- if page.id != homepage.id
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}

View file

@ -0,0 +1,7 @@
.column_content
%table
%tr
%th Titel
%th Zuletzt aktualisiert
- for page in @pages
= render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -8,13 +8,14 @@
#sidebar #sidebar
#sidebar-links= link_to "Neue Seite anlegen", new_page_path #sidebar-links
= link_to "Neue Seite anlegen", new_page_path
%table .left_column{:style => "width:100%"}
%tr .box_title
%th Titel #editOrderNav
%th Zuletzt aktualisiert = remote_link_to 'Letzte Änderungen', :update => 'left_column', :url => {:action => 'all', :view => 'recentChanges'}
- for page in @pages = remote_link_to 'Seiten-Liste', :update => 'left_column', :url => {:action => 'all', :view => 'titleList'}
%tr = remote_link_to 'Site Map', :update => 'left_column', :url => {:action => 'all', :view => 'siteMap'}
%td= link_to page.title, wiki_page_path(page.permalink) #left_column
%td= format_datetime page.updated_at = render :partial => 'recent_changes'