diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-27 19:35:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-27 19:35:53 +0000 |
commit | 20aff7cc7077650c2021b8bab27a87e5b6cf0d9d (patch) | |
tree | 70fa25932dfa3937cf85fc896d1cfcf7c6a21954 /app | |
parent | d823c284843440c28a2a05b83f35657eaa11c00b (diff) | |
download | redmine-20aff7cc7077650c2021b8bab27a87e5b6cf0d9d.tar.gz redmine-20aff7cc7077650c2021b8bab27a87e5b6cf0d9d.zip |
Added wiki index by date.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@768 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/wiki_controller.rb | 3 | ||||
-rw-r--r-- | app/views/wiki/_sidebar.rhtml | 5 | ||||
-rw-r--r-- | app/views/wiki/special_date_index.rhtml | 25 | ||||
-rw-r--r-- | app/views/wiki/special_page_index.rhtml | 24 |
4 files changed, 46 insertions, 11 deletions
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 @@ <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 /> 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 @@ +<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> + 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 @@ -<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_index_by_title) %></h2> -<h2><%= l(:label_page_index) %></h2> +<% if @pages.empty? %> +<p class="nodata"><%= l(:label_no_data) %></p> +<% end %> -<% 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>
\ No newline at end of file +<% 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> + |