From 305a4ac89541d551cc7c1a819acd92e9fa6b2ac6 Mon Sep 17 00:00:00 2001 From: sandoz Date: Mon, 5 Oct 2009 13:36:57 +0200 Subject: [PATCH 1/2] Don't show action "Create invoice" for stock order --- app/views/finance/balancing/new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/finance/balancing/new.html.haml b/app/views/finance/balancing/new.html.haml index 8422727c..49d7870c 100644 --- a/app/views/finance/balancing/new.html.haml +++ b/app/views/finance/balancing/new.html.haml @@ -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 From 90f760858e4022b26e3d3d544cbdeedf7e8a6e7e Mon Sep 17 00:00:00 2001 From: sandoz Date: Mon, 5 Oct 2009 17:25:19 +0200 Subject: [PATCH 2/2] Added site map and titel list to pages/all * pages/all now consists of three alternativ views: recent changes, site map and title list --- app/controllers/pages_controller.rb | 16 +++++++++++++++- app/models/page.rb | 1 + app/views/pages/_page_list_item.html.haml | 8 ++++++++ app/views/pages/_recent_changes.html.haml | 7 +++++++ app/views/pages/_site_map.html.haml | 10 ++++++++++ app/views/pages/_title_list.html.haml | 7 +++++++ app/views/pages/all.html.haml | 19 ++++++++++--------- 7 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 app/views/pages/_page_list_item.html.haml create mode 100644 app/views/pages/_recent_changes.html.haml create mode 100644 app/views/pages/_site_map.html.haml create mode 100644 app/views/pages/_title_list.html.haml diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 7b60eef6..78c65144 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -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 diff --git a/app/models/page.rb b/app/models/page.rb index ab153204..08d4c21c 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -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(/[\"\']/, "") diff --git a/app/views/pages/_page_list_item.html.haml b/app/views/pages/_page_list_item.html.haml new file mode 100644 index 00000000..1e7f3c89 --- /dev/null +++ b/app/views/pages/_page_list_item.html.haml @@ -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} \ No newline at end of file diff --git a/app/views/pages/_recent_changes.html.haml b/app/views/pages/_recent_changes.html.haml new file mode 100644 index 00000000..213ca5f8 --- /dev/null +++ b/app/views/pages/_recent_changes.html.haml @@ -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} diff --git a/app/views/pages/_site_map.html.haml b/app/views/pages/_site_map.html.haml new file mode 100644 index 00000000..ba787638 --- /dev/null +++ b/app/views/pages/_site_map.html.haml @@ -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} diff --git a/app/views/pages/_title_list.html.haml b/app/views/pages/_title_list.html.haml new file mode 100644 index 00000000..855a37bf --- /dev/null +++ b/app/views/pages/_title_list.html.haml @@ -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} \ No newline at end of file diff --git a/app/views/pages/all.html.haml b/app/views/pages/all.html.haml index 1150eba1..49f3fd74 100644 --- a/app/views/pages/all.html.haml +++ b/app/views/pages/all.html.haml @@ -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' \ No newline at end of file