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:
parent
305a4ac895
commit
90f760858e
7 changed files with 58 additions and 10 deletions
|
@ -96,7 +96,21 @@ class PagesController < ApplicationController
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
def version
|
||||
|
|
|
@ -31,6 +31,7 @@ class Page < ActiveRecord::Base
|
|||
after_update :create_redirect
|
||||
|
||||
named_scope :non_redirected, :conditions => {:redirect => nil}
|
||||
named_scope :no_parent, :conditions => {:parent_id => nil}
|
||||
|
||||
def self.permalink(title)
|
||||
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")
|
||||
|
|
8
app/views/pages/_page_list_item.html.haml
Normal file
8
app/views/pages/_page_list_item.html.haml
Normal 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}
|
7
app/views/pages/_recent_changes.html.haml
Normal file
7
app/views/pages/_recent_changes.html.haml
Normal 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}
|
10
app/views/pages/_site_map.html.haml
Normal file
10
app/views/pages/_site_map.html.haml
Normal 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}
|
7
app/views/pages/_title_list.html.haml
Normal file
7
app/views/pages/_title_list.html.haml
Normal 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}
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
|
||||
#sidebar
|
||||
#sidebar-links= link_to "Neue Seite anlegen", new_page_path
|
||||
#sidebar-links
|
||||
= link_to "Neue Seite anlegen", new_page_path
|
||||
|
||||
%table
|
||||
%tr
|
||||
%th Titel
|
||||
%th Zuletzt aktualisiert
|
||||
- for page in @pages
|
||||
%tr
|
||||
%td= link_to page.title, wiki_page_path(page.permalink)
|
||||
%td= format_datetime page.updated_at
|
||||
.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'}
|
||||
#left_column
|
||||
= render :partial => 'recent_changes'
|
Loading…
Reference in a new issue