diff options
| author | hukl <contact@smyck.org> | 2009-10-07 23:36:03 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-10-07 23:36:03 +0200 |
| commit | 262f4e0c2abfefbd6965358fdfd9a8c332a38d57 (patch) | |
| tree | 91055edbbbec337ffd8745239b9d3ccdd8aebb9a /app/views/revisions | |
| parent | d3271f55b56e0fb5f73cf5691f90be9370d85d80 (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/revisions')
| -rw-r--r-- | app/views/revisions/diff.html.erb | 6 | ||||
| -rw-r--r-- | app/views/revisions/index.html.erb | 45 | ||||
| -rw-r--r-- | app/views/revisions/show.html.erb | 88 |
3 files changed, 94 insertions, 45 deletions
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 | ||
