diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/revisions_controller.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb new file mode 100644 index 0000000..565a25f --- /dev/null +++ b/app/controllers/revisions_controller.rb | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | class RevisionsController < ApplicationController | ||
| 2 | |||
| 3 | layout 'admin' | ||
| 4 | |||
| 5 | def index | ||
| 6 | end | ||
| 7 | |||
| 8 | def diff | ||
| 9 | @node = Node.find(params[:id]) | ||
| 10 | |||
| 11 | if @node.pages.length > 1 | ||
| 12 | params[:start] ||= @node.pages.all[-1].revision | ||
| 13 | params[:end] ||= @node.pages.all[-2].revision | ||
| 14 | else | ||
| 15 | params[:start], params[:end] = 1, 1 | ||
| 16 | end | ||
| 17 | |||
| 18 | @start = Page.find( :first, :conditions => { | ||
| 19 | :node_id => params[:id], | ||
| 20 | :revision => params[:start] | ||
| 21 | }) | ||
| 22 | |||
| 23 | @end = Page.find( :first, :conditions => { | ||
| 24 | :node_id => params[:id], | ||
| 25 | :revision => params[:end] | ||
| 26 | }) | ||
| 27 | |||
| 28 | end | ||
| 29 | |||
| 30 | def show | ||
| 31 | @node = Node.find(params[:id]) | ||
| 32 | end | ||
| 33 | |||
| 34 | end | ||
