From 20aff7cc7077650c2021b8bab27a87e5b6cf0d9d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 27 Sep 2007 19:35:53 +0000 Subject: Added wiki index by date. git-svn-id: http://redmine.rubyforge.org/svn/trunk@768 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 3 ++- app/views/wiki/_sidebar.rhtml | 5 +++-- app/views/wiki/special_date_index.rhtml | 25 +++++++++++++++++++++++++ app/views/wiki/special_page_index.rhtml | 24 ++++++++++++++++-------- 4 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 app/views/wiki/special_date_index.rhtml (limited to 'app') diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 5bade625e..e3c9ed202 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -121,11 +121,12 @@ class WikiController < ApplicationController page_title = params[:page].downcase case page_title # show pages index, sorted by title - when 'page_index' + when 'page_index', 'date_index' # eager load information about last updates, without loading text @pages = @wiki.pages.find :all, :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", :joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id", :order => 'title' + @pages_by_date = @pages.group_by {|p| p.updated_on.to_date} # export wiki to a single html file when 'export' @pages = @wiki.pages.find :all, :order => 'title' diff --git a/app/views/wiki/_sidebar.rhtml b/app/views/wiki/_sidebar.rhtml index b45aa7233..20c087123 100644 --- a/app/views/wiki/_sidebar.rhtml +++ b/app/views/wiki/_sidebar.rhtml @@ -1,4 +1,5 @@

<%= l(:label_wiki) %>

-<%= link_to l(:label_page_index), {:action => 'special', :page => 'Page_index'} %> - +<%= link_to l(:field_start_page), {:action => 'index', :page => nil} %>
+<%= link_to l(:label_index_by_title), {:action => 'special', :page => 'Page_index'} %>
+<%= link_to l(:label_index_by_date), {:action => 'special', :page => 'Date_index'} %>
diff --git a/app/views/wiki/special_date_index.rhtml b/app/views/wiki/special_date_index.rhtml new file mode 100644 index 000000000..ac68f809e --- /dev/null +++ b/app/views/wiki/special_date_index.rhtml @@ -0,0 +1,25 @@ +

<%= l(:label_index_by_date) %>

+ +<% if @pages.empty? %> +

<%= l(:label_no_data) %>

+<% end %> + +<% @pages_by_date.keys.sort.reverse.each do |date| %> +

<%= format_date(date) %>

+ +<% end %> + +<% content_for :sidebar do %> + <%= render :partial => 'sidebar' %> +<% end %> + +
+<% unless @pages.empty? %> +<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %> +<% end %> +
+  diff --git a/app/views/wiki/special_page_index.rhtml b/app/views/wiki/special_page_index.rhtml index ba3cfeed1..8d3cd8a42 100644 --- a/app/views/wiki/special_page_index.rhtml +++ b/app/views/wiki/special_page_index.rhtml @@ -1,13 +1,21 @@ -
-<% unless @pages.empty? %> -<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %> -<% end %> -
+

<%= l(:label_index_by_title) %>

-

<%= l(:label_page_index) %>

+<% if @pages.empty? %> +

<%= l(:label_no_data) %>

+<% end %> -<% if @pages.empty? %>

<%= l(:label_no_data) %>

<% end %> \ No newline at end of file +<% end %> + +<% content_for :sidebar do %> + <%= render :partial => 'sidebar' %> +<% end %> + +
+<% unless @pages.empty? %> +<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %> +<% end %> +
+  -- cgit v1.2.3