From 332ffbeed90cf07342925b82ed3fda1762346be2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 9 Jul 2026 02:25:56 +0200 Subject: Restyle revisions#index: sticky diff bar, computation button style, pre-selected defaults Adds a fourth button category, .computation -- teal, matching Preview's existing color -- for actions that compute a view without changing state, the first case in the app that didn't fit reversible/state-changing/ destructive. Diff revisions now starts disabled and only enables once two distinct revisions are selected, matching the disabled-state pattern already used for Unlock + Back. The header row is wrapped in a real (previously flat inside the table alongside data rows) so a sticky diff bar can sit above the fold on long revision lists -- selecting a comparison pair no longer requires scrolling back up to find the button, or back down to confirm what's selected, both surfaced live via one shared JS function. The two most recent revisions are pre-selected by default, covering the most common comparison (current against previous) with no extra clicks. Deliberately scoped to numbered revisions only -- comparing draft/head or autosave/draft was raised and set aside, since neither exists as a row in this table by design and extending the comparison to them is a separate feature, not a default on this one. Also drops the dead "Edit" subnav link, redundant with nodes#show's Status section covering the same action with state-aware labeling this static link could never have. --- app/views/revisions/index.html.erb | 100 +++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 38 deletions(-) (limited to 'app/views') diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb index 26a9ff4..a6a981a 100644 --- a/app/views/revisions/index.html.erb +++ b/app/views/revisions/index.html.erb @@ -1,46 +1,70 @@ -<% content_for :subnavigation do %> - <%= link_to 'Edit', edit_node_path(@node) %> -<% end %> -

Revisions for Node: <%= @node.unique_name %>

- - - - - - - - - - - -<% (@pages || @node.pages.all).reverse.each do |page| %> - - - - - - - - - - -<% end %> - - - +
FirstLastRev.TitleEditorDate
<%= radio_button_tag :start_revision, page.revision %><%= radio_button_tag :end_revision, page.revision %><%= page.revision %><%= page.title %><%= page.editor.try(:login) %><%= page.updated_at %><%= link_to 'show', node_revision_path(@node, page) %> - <%= button_to 'restore', restore_node_revision_path(@node, page), - method: :put, - form: { data: { confirm: "Restore this revision?" }, class: 'button_to state_changing' } %> -
- <%= button_to 'Diff revisions', diff_node_revisions_path(@node), - method: :post, - form: { id: 'diff_form' } %> -
+ + + + + + + + + + + + + + + + + <% pages = (@pages || @node.pages.all).reverse %> + <% pages.each_with_index do |page, index| %> + + + + + + + + + + + <% end %> +
FirstLastRev.TitleEditorDate
+ <%= button_to 'Diff revisions', diff_node_revisions_path(@node), + method: :post, + form: { id: 'diff_form', class: 'button_to computation' }, + disabled: true %> + +
<%= radio_button_tag :start_revision, page.revision, index == 1 %><%= radio_button_tag :end_revision, page.revision, index == 0 %><%= page.revision %><%= page.title %><%= page.editor.try(:login) %><%= page.updated_at %><%= link_to 'show', node_revision_path(@node, page) %> + <%= button_to 'restore', restore_node_revision_path(@node, page), + method: :put, + form: { data: { confirm: "Restore this revision?" }, class: 'button_to state_changing' } %> +