Added the ability to easily rollback to a previous version of a wiki page.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@424 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-04-05 14:45:44 +00:00
parent 7eb4abae80
commit f3a1b4e38c
10 changed files with 17 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ class WikiController < ApplicationController
edit
render :action => 'edit' and return
end
@content = (params[:version] ? @page.content.versions.find_by_version(params[:version]) : @page.content)
@content = @page.content_for_version(params[:version])
if params[:export] == 'html'
export = render_to_string :action => 'export', :layout => false
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
@@ -43,7 +43,8 @@ class WikiController < ApplicationController
def edit
@page = @wiki.find_or_new_page(params[:page])
@page.content = WikiContent.new(:page => @page) if @page.new_record?
@content = @page.content
@content = @page.content_for_version(params[:version])
@content.text = "h1. #{@page.pretty_title}" if @content.text.blank?
# don't keep previous comment
@content.comment = nil