summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-05-01 18:14:59 +0200
committerhukl <contact@smyck.org>2009-05-01 18:14:59 +0200
commit8d084cf690a78eae0df5c9e13b34ed3c08f6e161 (patch)
tree7df74078236c5533ada0a4e8f6b8a5515128172d /app
parente9064192e9a38dd1ec8314d99bf3cc553e38b30c (diff)
introducing the restore revision functionality
Diffstat (limited to 'app')
-rw-r--r--app/controllers/revisions_controller.rb6
-rw-r--r--app/views/revisions/show.html.erb14
2 files changed, 18 insertions, 2 deletions
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb
index 7ae22f8..e2c0432 100644
--- a/app/controllers/revisions_controller.rb
+++ b/app/controllers/revisions_controller.rb
@@ -32,4 +32,10 @@ class RevisionsController < ApplicationController
32 @node = Node.find(params[:id]) 32 @node = Node.find(params[:id])
33 end 33 end
34 34
35 def restore
36 page = Page.find(params[:id])
37 page.node.restore_revision! page.revision
38 flash[:notice] = "Revision #{page.revision} restored"
39 redirect_to :back
40 end
35end 41end
diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb
index 2a4a9a1..ebda18d 100644
--- a/app/views/revisions/show.html.erb
+++ b/app/views/revisions/show.html.erb
@@ -23,11 +23,21 @@
23 <td class="title"><%= page.title %></td> 23 <td class="title"><%= page.title %></td>
24 <td class="user"><%= page.user.try(:login) %></td> 24 <td class="user"><%= page.user.try(:login) %></td>
25 <td class="date"><%= page.updated_at %></td> 25 <td class="date"><%= page.updated_at %></td>
26 <td class="actions"><%= link_to 'show', node_path(page.node) %></td> 26 <td>
27 <%= link_to 'show', node_path(page.node) %>
28 </td>
29 <td>
30 <%= link_to(
31 'restore',
32 restore_revision_path(page),
33 :method => :put,
34 :confirm => "Restore this revision?"
35 ) %>
36 </td>
27 </tr> 37 </tr>
28<% end %> 38<% end %>
29 <tr class="no_hover"> 39 <tr class="no_hover">
30 <td colspan="7" class="right"><%= submit_tag 'Diff revisions' %></td> 40 <td colspan="8" class="right"><%= submit_tag 'Diff revisions' %></td>
31 </tr> 41 </tr>
32</table> 42</table>
33 43