Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-03-31 16:23:11 -05:00
commit 62fd333e71
4 changed files with 13 additions and 4 deletions

View file

@ -9,7 +9,7 @@ class WikiController < ApplicationController
before_filter :load_page
before_filter :dnsbl_check, :only => [:edit, :new, :save, :export_html, :export_markup]
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list, :file_list,
:history, :atom_with_content, :atom_with_headlines, :if => Proc.new { |c| c.send(:do_caching?) }
:history, :revision, :atom_with_content, :atom_with_headlines, :if => Proc.new { |c| c.send(:do_caching?) }
cache_sweeper :revision_sweeper
layout 'default', :except => [:atom_with_content, :atom_with_headlines, :atom, :tex, :s5, :export_html]

View file

@ -54,6 +54,11 @@ module ApplicationHelper
# Create a hyperlink to a particular revision of a Wiki page
def link_to_revision(page, revision_number, text = nil, mode = nil, html_options = {})
revision_number == page.revisions.length ?
link_to(
text || page.plain_name,
{:web => @web.address, :action => 'show', :id => page.name,
:mode => mode}, html_options) :
link_to(
text || page.plain_name + "(rev # #{revision_number})",
{:web => @web.address, :action => 'revision', :id => page.name,

View file

@ -7,7 +7,10 @@
<%- for rev in @revisions_by_day[day] -%>
<li>
<%= link_to_revision(rev.page, @revision_numbers[rev.id],
text="Revision #{@revision_numbers[rev.id]}") %>
text= (rev.page.revisions.length == @revision_numbers[rev.id] ?
"Current" :
"Revision #{@revision_numbers[rev.id]}" )
) %>
<%- if @revision_numbers[rev.id] > 1 -%>
(<%= link_to_revision(rev.page, @revision_numbers[rev.id],
text="diff", mode='diff') %>)

View file

@ -26,7 +26,8 @@ ActionController::Routing::Routes.draw do |map|
connect_to_web map, ':web/login', :controller => 'wiki', :action => 'login'
connect_to_web map, ':web/web_list', :controller => 'wiki', :action => 'web_list'
connect_to_web map, ':web/show/diff/:id', :controller => 'wiki', :action => 'show', :mode => 'diff'
connect_to_web map, ':web/revision/diff/:id', :controller => 'wiki', :action => 'revision', :mode => 'diff'
connect_to_web map, ':web/revision/diff/:id/:rev', :controller => 'wiki', :action => 'revision', :mode => 'diff', :requirements => { :rev => /\d*/}
connect_to_web map, ':web/revision/:id/:rev', :controller => 'wiki', :action => 'revision', :requirements => { :rev => /\d*/}
connect_to_web map, ':web/list/:category', :controller => 'wiki', :action => 'list', :requirements => { :category => /.*/}, :category => nil
connect_to_web map, ':web/recently_revised/:category', :controller => 'wiki', :action => 'recently_revised', :requirements => { :category => /.*/}, :category => nil
connect_to_web map, ':web/:action/:id', :controller => 'wiki'