diff options
| author | hukl <contact@smyck.org> | 2009-03-15 19:27:37 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-15 19:27:37 +0100 |
| commit | 7f82b8e23ec9b76d0b8a417b2d2b577aeaf7a55f (patch) | |
| tree | c70ba3e35987c035831c6244874774491285a99d /app | |
| parent | a936993a5a7bbe7bb4f679d3adc059929cd0d7c5 (diff) | |
adding revision links to the interface. disabling destroy for now
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/revisions_controller.rb | 9 | ||||
| -rw-r--r-- | app/views/nodes/index.html.erb | 3 | ||||
| -rw-r--r-- | app/views/revisions/show.html.erb | 19 |
3 files changed, 26 insertions, 5 deletions
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb index 20991ef..565a25f 100644 --- a/app/controllers/revisions_controller.rb +++ b/app/controllers/revisions_controller.rb | |||
| @@ -8,8 +8,12 @@ class RevisionsController < ApplicationController | |||
| 8 | def diff | 8 | def diff |
| 9 | @node = Node.find(params[:id]) | 9 | @node = Node.find(params[:id]) |
| 10 | 10 | ||
| 11 | params[:start] ||= @node.pages.all[-1].revision | 11 | if @node.pages.length > 1 |
| 12 | params[:end] ||= @node.pages.all[-2].revision | 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 | ||
| 13 | 17 | ||
| 14 | @start = Page.find( :first, :conditions => { | 18 | @start = Page.find( :first, :conditions => { |
| 15 | :node_id => params[:id], | 19 | :node_id => params[:id], |
| @@ -24,6 +28,7 @@ class RevisionsController < ApplicationController | |||
| 24 | end | 28 | end |
| 25 | 29 | ||
| 26 | def show | 30 | def show |
| 31 | @node = Node.find(params[:id]) | ||
| 27 | end | 32 | end |
| 28 | 33 | ||
| 29 | end | 34 | end |
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb index a2a42b1..31cd53c 100644 --- a/app/views/nodes/index.html.erb +++ b/app/views/nodes/index.html.erb | |||
| @@ -24,7 +24,8 @@ | |||
| 24 | <td> | 24 | <td> |
| 25 | <%= link_to 'Show', node_path(node) %> | 25 | <%= link_to 'Show', node_path(node) %> |
| 26 | <%= link_to 'Edit', edit_node_path(node) %> | 26 | <%= link_to 'Edit', edit_node_path(node) %> |
| 27 | <%= link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %> | 27 | <%= link_to 'Revision', :controller => :revisions, :action => :show, :id => node.id %> |
| 28 | <%# link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %> | ||
| 28 | <%= link_to 'Unlock', unlock_node_path(node), :method => :put, :confirm => "Are you sure you want to unlock?" %> | 29 | <%= link_to 'Unlock', unlock_node_path(node), :method => :put, :confirm => "Are you sure you want to unlock?" %> |
| 29 | </td> | 30 | </td> |
| 30 | <td> | 31 | <td> |
diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index 20fc39c..c63e7e8 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb | |||
| @@ -1,2 +1,17 @@ | |||
| 1 | <h1>Revisions#show</h1> | 1 | <div id="subnavigation"> |
| 2 | <p>Find me in app/views/revisions/show.html.erb</p> | 2 | <%= link_to 'Diff revisions', :action => :diff, :id => params[:id] %> |
| 3 | </div> | ||
| 4 | |||
| 5 | <h2>Revisions for Node: <%= @node.unique_name %></h2> | ||
| 6 | |||
| 7 | <h3>Current title: <%= @node.head.title %></h3> | ||
| 8 | <table> | ||
| 9 | <% @node.pages.reverse.each do |page| %> | ||
| 10 | <tr> | ||
| 11 | <td><%= page.revision %></td> | ||
| 12 | <td><%= page.title %></td> | ||
| 13 | <td><%= page.user.try(:login) %></td> | ||
| 14 | <td><%= page.updated_at %></td> | ||
| 15 | </tr> | ||
| 16 | <% end %> | ||
| 17 | </table> \ No newline at end of file | ||
