From 20aff7cc7077650c2021b8bab27a87e5b6cf0d9d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 27 Sep 2007 19:35:53 +0000 Subject: [PATCH] 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 ++++++++++++++++-------- lang/bg.yml | 3 ++- lang/cs.yml | 3 ++- lang/de.yml | 3 ++- lang/en.yml | 3 ++- lang/es.yml | 3 ++- lang/fr.yml | 3 ++- lang/it.yml | 3 ++- lang/ja.yml | 3 ++- lang/nl.yml | 3 ++- lang/pl.yml | 3 ++- lang/pt-br.yml | 3 ++- lang/pt.yml | 3 ++- lang/sv.yml | 3 ++- lang/zh.yml | 3 ++- 18 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 app/views/wiki/special_date_index.rhtml diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 5bade625..e3c9ed20 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 b45aa723..20c08712 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 00000000..ac68f809 --- /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 ba3cfeed..8d3cd8a4 100644 --- a/app/views/wiki/special_page_index.rhtml +++ b/app/views/wiki/special_page_index.rhtml @@ -1,13 +1,21 @@ +

<%= l(:label_index_by_title) %>

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

<%= l(:label_no_data) %>

+<% 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 %>
- -

<%= l(:label_page_index) %>

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

<%= l(:label_no_data) %>

<% end %> - \ No newline at end of file +  diff --git a/lang/bg.yml b/lang/bg.yml index 01a5f350..c15abfea 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki редакция label_wiki_edit_plural: Wiki редакции label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Индекс +label_index_by_title: Индекс +label_index_by_date: Index by date label_current_version: Текуща версия label_preview: Преглед label_feed_plural: Feeds diff --git a/lang/cs.yml b/lang/cs.yml index 5cadd654..8a68d95b 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -355,7 +355,8 @@ label_wiki_edit: Wiki úprava label_wiki_edit_plural: Wiki úpravy label_wiki_page: Wiki stránka label_wiki_page_plural: Wiki stránky -label_page_index: Rejstřík +label_index_by_title: Rejstřík +label_index_by_date: Index by date label_current_version: Aktuální verze label_preview: Náhled label_feed_plural: Feeds diff --git a/lang/de.yml b/lang/de.yml index a1182f20..2fb1b1e9 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki-Bearbeitung label_wiki_edit_plural: Wiki-Bearbeitungen label_wiki_page: Wiki-Seite label_wiki_page_plural: Wiki-Seiten -label_page_index: Index +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Gegenwärtige Version label_preview: Vorschau label_feed_plural: Feeds diff --git a/lang/en.yml b/lang/en.yml index 0be3071b..9246c944 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki edit label_wiki_edit_plural: Wiki edits label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Index +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Current version label_preview: Preview label_feed_plural: Feeds diff --git a/lang/es.yml b/lang/es.yml index cc67ea67..09017909 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki edit label_wiki_edit_plural: Wiki edits label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Índice +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Versión actual label_preview: Previo label_feed_plural: Feeds diff --git a/lang/fr.yml b/lang/fr.yml index 06665af2..3f5371da 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -357,7 +357,8 @@ label_wiki_edit: Révision wiki label_wiki_edit_plural: Révisions wiki label_wiki_page: Page wiki label_wiki_page_plural: Pages wiki -label_page_index: Index +label_index_by_title: Index par titre +label_index_by_date: Index par date label_current_version: Version actuelle label_preview: Prévisualisation label_feed_plural: Flux RSS diff --git a/lang/it.yml b/lang/it.yml index 451e443a..73aa3437 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -357,7 +357,8 @@ label_wiki_edit: Modifica Wiki label_wiki_edit_plural: Modfiche wiki label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Indice +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Versione corrente label_preview: Anteprima label_feed_plural: Feed diff --git a/lang/ja.yml b/lang/ja.yml index a70e1e94..1e497790 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -358,7 +358,8 @@ label_wiki_edit: Wiki編集 label_wiki_edit_plural: Wiki編集 label_wiki_page: Wiki page label_wiki_page_plural: Wikiページ -label_page_index: 索引 +label_index_by_title: 索引 +label_index_by_date: Index by date label_current_version: 最新版 label_preview: プレビュー label_feed_plural: フィード diff --git a/lang/nl.yml b/lang/nl.yml index 473ef061..0c862ab3 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki edit label_wiki_edit_plural: Wiki edits label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Index +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Huidige versie label_preview: Testweergave label_feed_plural: Feeds diff --git a/lang/pl.yml b/lang/pl.yml index a0dc73cc..235231dd 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -348,7 +348,8 @@ label_wiki_edit: Edycja wiki label_wiki_edit_plural: Edycje wiki label_wiki_page: Strona wiki label_wiki_page_plural: Strony wiki -label_page_index: Indeks +label_index_by_title: Indeks +label_index_by_date: Index by date label_current_version: Obecna wersja label_preview: Podgląd label_feed_plural: Ilość RSS diff --git a/lang/pt-br.yml b/lang/pt-br.yml index 44906744..afcd4cb2 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki edit label_wiki_edit_plural: Wiki edits label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Index +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Versao atual label_preview: Previa label_feed_plural: Feeds diff --git a/lang/pt.yml b/lang/pt.yml index 62df91df..2ce44f49 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki edit label_wiki_edit_plural: Wiki edits label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Index +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Versão atual label_preview: Prévia label_feed_plural: Feeds diff --git a/lang/sv.yml b/lang/sv.yml index 1e3c9056..adcd2887 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -357,7 +357,8 @@ label_wiki_edit: Wiki editera label_wiki_edit_plural: Wiki editeringar label_wiki_page: Wiki page label_wiki_page_plural: Wiki pages -label_page_index: Index +label_index_by_title: Index by title +label_index_by_date: Index by date label_current_version: Nuvarande version label_preview: Preview label_feed_plural: Feeder diff --git a/lang/zh.yml b/lang/zh.yml index 47f8e861..c3edc030 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -359,7 +359,8 @@ label_wiki: Wiki label_wiki_edit: Wiki edit label_wiki_edit_plural: Wiki edits label_wiki_page_plural: Wiki pages -label_page_index: 索引 +label_index_by_title: 索引 +label_index_by_date: Index by date label_current_version: 当前版本 label_preview: 预览 label_feed_plural: Feeds