summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-10-07 23:36:03 +0200
committerhukl <contact@smyck.org>2009-10-07 23:36:03 +0200
commit262f4e0c2abfefbd6965358fdfd9a8c332a38d57 (patch)
tree91055edbbbec337ffd8745239b9d3ccdd8aebb9a /app/views
parentd3271f55b56e0fb5f73cf5691f90be9370d85d80 (diff)
refactored revsions controller to act as a nested resource of nodes. boy that cleaned up some stuff quite a bit. also having tests for that is just feeling great
Diffstat (limited to 'app/views')
-rw-r--r--app/views/nodes/edit.html.erb2
-rw-r--r--app/views/nodes/index.html.erb2
-rw-r--r--app/views/nodes/show.html.erb2
-rw-r--r--app/views/revisions/diff.html.erb6
-rw-r--r--app/views/revisions/index.html.erb45
-rw-r--r--app/views/revisions/show.html.erb88
6 files changed, 97 insertions, 48 deletions
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb
index 0635dac..0063dd9 100644
--- a/app/views/nodes/edit.html.erb
+++ b/app/views/nodes/edit.html.erb
@@ -3,7 +3,7 @@
3 <%= link_to 'Show', @node %> 3 <%= link_to 'Show', @node %>
4 <%= link_to 'Preview', preview_page_path(@draft) %> 4 <%= link_to 'Preview', preview_page_path(@draft) %>
5 <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> 5 <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %>
6 <%= link_to 'Revisions', revision_path(params[:id]) %> 6 <%= link_to 'Revisions', node_revisions_path(@node) %>
7<% end %> 7<% end %>
8 8
9<div id="page_editor"> 9<div id="page_editor">
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb
index 0603c08..d78a997 100644
--- a/app/views/nodes/index.html.erb
+++ b/app/views/nodes/index.html.erb
@@ -21,7 +21,7 @@
21 </td> 21 </td>
22 <td class="actions"> 22 <td class="actions">
23 <%= link_to 'show', node_path(node) %> 23 <%= link_to 'show', node_path(node) %>
24 <%= link_to 'Revisions', :controller => :revisions, :action => :show, :id => node.id %> 24 <%= link_to 'Revisions', node_revisions_path(node) %>
25 <%# link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %> 25 <%# link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %>
26 <%= link_to 'Unlock', unlock_node_path(node), :method => :put, :confirm => "Are you sure you want to unlock?" %> 26 <%= link_to 'Unlock', unlock_node_path(node), :method => :put, :confirm => "Are you sure you want to unlock?" %>
27 </td> 27 </td>
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb
index 8d8a985..8f56c7c 100644
--- a/app/views/nodes/show.html.erb
+++ b/app/views/nodes/show.html.erb
@@ -1,7 +1,7 @@
1<% content_for :subnavigation do %> 1<% content_for :subnavigation do %>
2 <%= link_to 'Edit', edit_node_path(@node), :class => "unselected" %> 2 <%= link_to 'Edit', edit_node_path(@node), :class => "unselected" %>
3 <%= link_to 'Preview', preview_page_path(@page) %> 3 <%= link_to 'Preview', preview_page_path(@page) %>
4 <%= link_to 'Revisions', revision_path(params[:id]) %> 4 <%= link_to 'Revisions', node_revisions_path(@node) %>
5 <%= link_to 'Unlock', unlock_node_path(@node), :method => :put, :confirm => "Are you sure you want to unlock?" %> 5 <%= link_to 'Unlock', unlock_node_path(@node), :method => :put, :confirm => "Are you sure you want to unlock?" %>
6<% end %> 6<% end %>
7 7
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb
index 9428b7a..f7ad79c 100644
--- a/app/views/revisions/diff.html.erb
+++ b/app/views/revisions/diff.html.erb
@@ -1,11 +1,11 @@
1<% content_for :subnavigation do %> 1<% content_for :subnavigation do %>
2 <%= link_to 'Edit', edit_node_path(@node) %> 2 <%= link_to 'Edit', edit_node_path(@node) %>
3 <%= link_to 'Revisions', revision_path(params[:id]) %> 3 <%= link_to 'Revisions', node_revisions_path(@node) %>
4<% end %> 4<% end %>
5 5
6<h1>Revisions#diff</h1> 6<h1>Revisions#diff</h1>
7 7
8<% form_tag diff_revision_path do %> 8<% form_tag diff_node_revisions_path do %>
9 <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %> 9 <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %>
10 <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> 10 <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %>
11 <%= submit_tag 'Diff' %> 11 <%= submit_tag 'Diff' %>
diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb
index e3134d7..dbb612b 100644
--- a/app/views/revisions/index.html.erb
+++ b/app/views/revisions/index.html.erb
@@ -1 +1,44 @@
1<h1>Revisions#index</h1> 1<% content_for :subnavigation do %>
2 <%= link_to 'Edit', edit_node_path(@node) %>
3<% end %>
4
5<h2>Revisions for Node: <%= @node.unique_name %></h2>
6
7<% form_tag diff_node_revisions_path(@node) do %>
8<table id="revisions">
9 <tr class="header">
10 <th>First</th>
11 <th>Last</th>
12 <th>Rev.</th>
13 <th>Title</th>
14 <th>User</th>
15 <th>Date</th>
16 <th></th>
17 </tr>
18<% @node.pages.reverse.each do |page| %>
19 <tr>
20 <td><%= radio_button_tag :start_revision, page.revision %></td>
21 <td><%= radio_button_tag :end_revision, page.revision %></td>
22 <td class="revision"><%= page.revision %></td>
23 <td class="title"><%= page.title %></td>
24 <td class="user"><%= page.user.try(:login) %></td>
25 <td class="date"><%= page.updated_at %></td>
26 <td>
27 <%= link_to 'show', node_revision_path(@node, page) %>
28 </td>
29 <td>
30 <%= link_to(
31 'restore',
32 restore_node_revision_path(@node, page),
33 :method => :put,
34 :confirm => "Restore this revision?"
35 ) %>
36 </td>
37 </tr>
38<% end %>
39 <tr class="no_hover">
40 <td colspan="8" class="right"><%= submit_tag 'Diff revisions' %></td>
41 </tr>
42</table>
43
44<% end %> \ No newline at end of file
diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb
index ebda18d..154d31b 100644
--- a/app/views/revisions/show.html.erb
+++ b/app/views/revisions/show.html.erb
@@ -1,44 +1,50 @@
1<% content_for :subnavigation do %> 1<% content_for :subnavigation do %>
2 <%= link_to 'Edit', edit_node_path(@node) %> 2 <%= link_to 'show all revisions', node_revisions_path(@node) %>
3<% end %> 3<% end %>
4 4
5<h2>Revisions for Node: <%= @node.unique_name %></h2> 5<div id="page_editor" class="show_node">
6 6 <table id="content">
7<% form_tag diff_revision_path do %> 7 <tr>
8<table id="revisions"> 8 <td class="description">Path</td>
9 <tr class="header"> 9 <td><%= @page.public_link %></td>
10 <th>First</th> 10 </tr>
11 <th>Last</th> 11 <tr>
12 <th>Rev.</th> 12 <td class="description">Author</td>
13 <th>Title</th> 13 <td><%= @page.user.try(:login) %></td>
14 <th>User</th> 14 </tr>
15 <th>Date</th> 15 <% if @page.node.locked? %>
16 <th></th> 16 <tr>
17 </tr> 17 <td class="description">Locked by</td>
18<% @node.pages.reverse.each do |page| %> 18 <td><%= @page.node.lock_owner.login %></td>
19 <tr> 19 </tr>
20 <td><%= radio_button_tag :start_revision, page.revision %></td> 20 <% end %>
21 <td><%= radio_button_tag :end_revision, page.revision %></td> 21 <tr>
22 <td class="revision"><%= page.revision %></td> 22 <td class="description">Last updated</td>
23 <td class="title"><%= page.title %></td> 23 <td><%= @page.updated_at %></td>
24 <td class="user"><%= page.user.try(:login) %></td> 24 </tr>
25 <td class="date"><%= page.updated_at %></td> 25 <tr>
26 <td> 26 <td class="description">Published at</td>
27 <%= link_to 'show', node_path(page.node) %> 27 <td><%= @page.published_at %></td>
28 </td> 28 </tr>
29 <td> 29 <tr>
30 <%= link_to( 30 <td class="description">Revision</td>
31 'restore', 31 <td><%= @page.revision %></td>
32 restore_revision_path(page), 32 </tr>
33 :method => :put, 33 <tr>
34 :confirm => "Restore this revision?" 34 <td class="description"><strong>Title</strong></td>
35 ) %> 35 <td><%= @page.title %></td>
36 </td> 36 </tr>
37 </tr> 37 <tr>
38<% end %> 38 <td class="description"><strong>Abstract</strong></td>
39 <tr class="no_hover"> 39 <td><%= @page.abstract %></td>
40 <td colspan="8" class="right"><%= submit_tag 'Diff revisions' %></td> 40 </tr>
41 </tr> 41 <tr>
42</table> 42 <td class="description"><strong>Body</strong></td>
43 43 <td><%= @page.body %></td>
44<% end %> \ No newline at end of file 44 </tr>
45 <tr>
46 <td></td>
47 <td class="right"></td>
48 </tr>
49 </table>
50</div> \ No newline at end of file