History Pages

From Jason Blevins:
  Create a "History" page for each wiki page.
  Link to it, and to the "Diff" page from "Recently Revised".
Also, correct a bug in listing/deleting links to uploaded
video and audio files.
This commit is contained in:
Jacques Distler 2009-03-30 23:50:06 -05:00
parent 7c0874bf4c
commit d5a65e6ac8
6 changed files with 74 additions and 2 deletions

View file

@ -52,6 +52,22 @@ module ApplicationHelper
UrlGenerator.new(@controller).make_link(page.author.name, page.web, nil, options)
end
# Create a hyperlink to a particular revision of a Wiki page
def link_to_revision(page, revision_number, text = nil, mode = nil, html_options = {})
link_to(
text || page.plain_name + "(rev # #{revision_number})",
{:web => @web.address, :action => 'revision', :id => page.name,
:rev => revision_number, :mode => mode}, html_options)
end
# Create a hyperlink to the history of a particular Wiki page
def link_to_history(page, text = nil, html_options = {})
link_to(
text || page.plain_name + "(history)",
{:web => @web.address, :action => 'history', :id => page.name},
html_options)
end
def base_url
home_page_url = url_for :controller => 'admin', :action => 'create_system', :only_path => true
home_page_url.sub(%r-/create_system/?$-, '')

View file

@ -6,6 +6,7 @@ module WikiHelper
menu << back_for_revision if @revision_number > 1
menu << current_revision
menu << see_or_hide_changes_for_revision if @revision_number > 1
menu << history if @page.revisions.length > 1
menu << rollback
menu
end
@ -18,6 +19,7 @@ module WikiHelper
menu << back_for_page
menu << see_or_hide_changes_for_page
end
menu << history if @page.revisions.length > 1
menu
end
@ -31,6 +33,11 @@ module WikiHelper
link_to('Edit Web', {:web => @web.address, :action => 'edit_web'},
{:class => 'navlink', :accesskey => 'W', :id => 'edit_web', :rel => 'nofollow'})
end
def history
link_to_history(@page, 'History',
{:class => 'navlink', :accesskey => 'S', :id => 'history', :rel => 'nofollow'})
end
def forward
if @revision_number < @page.revisions.length - 1