diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
| commit | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch) | |
| tree | 8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /app/views/revisions | |
| parent | 85a01e35274b8d4d4165a7b26bd7986e211246bb (diff) | |
| parent | 1853082fcd8c067390c246f9daa01a9b47387497 (diff) | |
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
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 | 40 |
2 files changed, 30 insertions, 16 deletions
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb index f7ad79c..b8d061d 100644 --- a/app/views/revisions/diff.html.erb +++ b/app/views/revisions/diff.html.erb | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | <h1>Revisions#diff</h1> | 6 | <h1>Revisions#diff</h1> |
| 7 | 7 | ||
| 8 | <% form_tag diff_node_revisions_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' %> |
| @@ -38,7 +38,7 @@ | |||
| 38 | </div> | 38 | </div> |
| 39 | </pre> | 39 | </pre> |
| 40 | 40 | ||
| 41 | <%= javascript_include_tag 'cacycle_diff' %> | 41 | <script src="/javascripts/cacycle_diff.js"></script> |
| 42 | <script type="text/javascript" charset="utf-8"> | 42 | <script type="text/javascript" charset="utf-8"> |
| 43 | window.onload = function() { | 43 | window.onload = function() { |
| 44 | title1 = document.getElementById('start_title').innerHTML; | 44 | title1 = document.getElementById('start_title').innerHTML; |
| @@ -62,4 +62,4 @@ | |||
| 62 | 62 | ||
| 63 | <h3>Body</h3> | 63 | <h3>Body</h3> |
| 64 | <p id="diffview_body"></p> | 64 | <p id="diffview_body"></p> |
| 65 | </div> \ No newline at end of file | 65 | </div> |
diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb index dc9ad51..b875a4f 100644 --- a/app/views/revisions/index.html.erb +++ b/app/views/revisions/index.html.erb | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | <h2>Revisions for Node: <%= @node.unique_name %></h2> | 5 | <h2>Revisions for Node: <%= @node.unique_name %></h2> |
| 6 | 6 | ||
| 7 | <% form_tag diff_node_revisions_path(@node) do %> | ||
| 8 | <table id="revisions"> | 7 | <table id="revisions"> |
| 9 | <tr class="header"> | 8 | <tr class="header"> |
| 10 | <th>First</th> | 9 | <th>First</th> |
| @@ -14,8 +13,9 @@ | |||
| 14 | <th>Editor</th> | 13 | <th>Editor</th> |
| 15 | <th>Date</th> | 14 | <th>Date</th> |
| 16 | <th></th> | 15 | <th></th> |
| 16 | <th></th> | ||
| 17 | </tr> | 17 | </tr> |
| 18 | <% @node.pages.reverse.each do |page| %> | 18 | <% (@pages || @node.pages.all).reverse.each do |page| %> |
| 19 | <tr> | 19 | <tr> |
| 20 | <td><%= radio_button_tag :start_revision, page.revision %></td> | 20 | <td><%= radio_button_tag :start_revision, page.revision %></td> |
| 21 | <td><%= radio_button_tag :end_revision, page.revision %></td> | 21 | <td><%= radio_button_tag :end_revision, page.revision %></td> |
| @@ -23,22 +23,36 @@ | |||
| 23 | <td class="title"><%= page.title %></td> | 23 | <td class="title"><%= page.title %></td> |
| 24 | <td class="user"><%= page.editor.try(:login) %></td> | 24 | <td class="user"><%= page.editor.try(:login) %></td> |
| 25 | <td class="date"><%= page.updated_at %></td> | 25 | <td class="date"><%= page.updated_at %></td> |
| 26 | <td><%= link_to 'show', node_revision_path(@node, page) %></td> | ||
| 26 | <td> | 27 | <td> |
| 27 | <%= link_to 'show', node_revision_path(@node, page) %> | 28 | <%= button_to 'restore', restore_node_revision_path(@node, page), |
| 28 | </td> | 29 | method: :put, |
| 29 | <td> | 30 | form: { data: { confirm: "Restore this revision?" } } %> |
| 30 | <%= link_to( | ||
| 31 | 'restore', | ||
| 32 | restore_node_revision_path(@node, page), | ||
| 33 | :method => :put, | ||
| 34 | :confirm => "Restore this revision?" | ||
| 35 | ) %> | ||
| 36 | </td> | 31 | </td> |
| 37 | </tr> | 32 | </tr> |
| 38 | <% end %> | 33 | <% end %> |
| 39 | <tr class="no_hover"> | 34 | <tr class="no_hover"> |
| 40 | <td colspan="8" class="right"><%= submit_tag 'Diff revisions' %></td> | 35 | <td colspan="8" class="right"> |
| 36 | <%= button_to 'Diff revisions', diff_node_revisions_path(@node), | ||
| 37 | method: :post, | ||
| 38 | form: { id: 'diff_form' } %> | ||
| 39 | </td> | ||
| 41 | </tr> | 40 | </tr> |
| 42 | </table> | 41 | </table> |
| 43 | 42 | ||
| 44 | <% end %> \ No newline at end of file | 43 | <script> |
| 44 | document.getElementById('diff_form').addEventListener('submit', function(e) { | ||
| 45 | var start = document.querySelector('input[name="start_revision"]:checked'); | ||
| 46 | var end = document.querySelector('input[name="end_revision"]:checked'); | ||
| 47 | if (start) { | ||
| 48 | var s = document.createElement('input'); | ||
| 49 | s.type = 'hidden'; s.name = 'start_revision'; s.value = start.value; | ||
| 50 | this.appendChild(s); | ||
| 51 | } | ||
| 52 | if (end) { | ||
| 53 | var en = document.createElement('input'); | ||
| 54 | en.type = 'hidden'; en.name = 'end_revision'; en.value = end.value; | ||
| 55 | this.appendChild(en); | ||
| 56 | } | ||
| 57 | }); | ||
| 58 | </script> | ||
