summaryrefslogtreecommitdiffstats
path: root/app/controllers/wiki_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-07-14 11:25:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-07-14 11:25:03 +0000
commit5e20417e6d523372320861f1d9a446ddd75e041f (patch)
tree9f276a706577f6959fb7465e00e74c3f69258c6e /app/controllers/wiki_controller.rb
parentbf74efcd1159d9872cdbdc55e9b859c3b2928ffc (diff)
downloadredmine-5e20417e6d523372320861f1d9a446ddd75e041f.tar.gz
redmine-5e20417e6d523372320861f1d9a446ddd75e041f.zip
Added wiki diff.
Diff can be viewed from the page history, or directly from the project activity page for each edit. Uses Lars Christensen's diff library. git-svn-id: http://redmine.rubyforge.org/svn/trunk@583 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/wiki_controller.rb')
-rw-r--r--app/controllers/wiki_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index bebe1d5ac..d75b85b64 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+require 'diff'
+
class WikiController < ApplicationController
layout 'base'
before_filter :find_wiki, :check_project_privacy
@@ -84,12 +86,18 @@ class WikiController < ApplicationController
@versions = @page.content.versions.find :all,
:select => "id, author_id, comments, updated_on, version",
:order => 'version DESC',
- :limit => @version_pages.items_per_page,
+ :limit => @version_pages.items_per_page + 1,
:offset => @version_pages.current.offset
render :layout => false if request.xhr?
end
+ def diff
+ @page = @wiki.find_page(params[:page])
+ @diff = @page.diff(params[:version], params[:version_from])
+ render_404 unless @diff
+ end
+
# remove a wiki page and its history
def destroy
@page = @wiki.find_page(params[:page])