Merge branch 'master' of git@github.com:bennibu/foodsoft
This commit is contained in:
commit
f34c307540
8 changed files with 59 additions and 11 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(/[\"\']/, "")
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
%h2 Aktionen
|
||||
.column_content
|
||||
%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)
|
||||
- unless @order.closed?
|
||||
%li= link_to "Bestellung abschließen", :action => "confirm", :id => @order
|
||||
|
|
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