Merge branch 'master' of git@github.com:bennibu/foodsoft

This commit is contained in:
Benjamin Meichsner 2009-10-12 14:44:48 +02:00
commit f34c307540
8 changed files with 59 additions and 11 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

@ -21,7 +21,7 @@
%h2 Aktionen %h2 Aktionen
.column_content .column_content
%ul %ul
- unless @order.invoice - unless @order.invoice or @order.stockit?
%li= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier) %li= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier)
- unless @order.closed? - unless @order.closed?
%li= link_to "Bestellung abschließen", :action => "confirm", :id => @order %li= link_to "Bestellung abschließen", :action => "confirm", :id => @order

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'