Added wiki index by date.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@768 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-09-27 19:35:53 +00:00
parent d823c28484
commit 20aff7cc70
18 changed files with 74 additions and 25 deletions

View File

@ -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'

View File

@ -1,4 +1,5 @@
<h3><%= l(:label_wiki) %></h3>
<%= link_to l(:label_page_index), {:action => 'special', :page => 'Page_index'} %>
<%= link_to l(:field_start_page), {:action => 'index', :page => nil} %><br />
<%= link_to l(:label_index_by_title), {:action => 'special', :page => 'Page_index'} %><br />
<%= link_to l(:label_index_by_date), {:action => 'special', :page => 'Date_index'} %><br />

View File

@ -0,0 +1,25 @@
<h2><%= l(:label_index_by_date) %></h2>
<% if @pages.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<% @pages_by_date.keys.sort.reverse.each do |date| %>
<h3><%= format_date(date) %></h3>
<ul>
<% @pages_by_date[date].each do |page| %>
<li><%= link_to page.pretty_title, :action => 'index', :page => page.title %></li>
<% end %>
</ul>
<% end %>
<% content_for :sidebar do %>
<%= render :partial => 'sidebar' %>
<% end %>
<div class="contextual">
<% unless @pages.empty? %>
<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %>
<% end %>
</div>
&nbsp;

View File

@ -1,13 +1,21 @@
<h2><%= l(:label_index_by_title) %></h2>
<% if @pages.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul><% @pages.each do |page| %>
<li><%= link_to page.pretty_title, :action => 'index', :page => page.title %> -
<%= l(:label_last_updates) %>: <%= format_time(page.updated_on) %></li>
<% end %></ul>
<% content_for :sidebar do %>
<%= render :partial => 'sidebar' %>
<% end %>
<div class="contextual">
<% unless @pages.empty? %>
<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %>
<% end %>
</div>
<h2><%= l(:label_page_index) %></h2>
<% if @pages.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
<ul><% @pages.each do |page| %>
<li><%= link_to page.pretty_title, :action => 'index', :page => page.title %> -
<%= l(:label_last_updates) %>: <%= format_time(page.updated_on) %></li>
<% end %></ul>
&nbsp;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: フィード

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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