From 49de2e14972030a7ef0ca36a94ab55a23a2f3596 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 18 Jul 2026 04:33:53 +0200 Subject: Annotate the History list with each revision's lifecycle Each row in nodes#show's History section now carries terse badges from the action log: created, published, and restored (rollback re-promotion), with date and actor, rendered from entry metadata alone. Backfilled entries wear the inferred marker, so reconstructed provenance stays distinguishable from witnessed history. A revision that was published and later restored shows both badges chronologically -- its true biography. Only create and publish entries carry page_id; trash, restore, and destroy annotate the node's own log zoom instead of any single revision, by design. --- app/helpers/node_actions_helper.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'app/helpers') diff --git a/app/helpers/node_actions_helper.rb b/app/helpers/node_actions_helper.rb index c829dff7..eb761e3b 100644 --- a/app/helpers/node_actions_helper.rb +++ b/app/helpers/node_actions_helper.rb @@ -59,6 +59,32 @@ module NodeActionsHelper end end + def revision_lifecycle_badges actions + return "" if actions.blank? + + badges = actions.map do |action| + key = case action.action + when "create" then "node_actions.revision_created" + when "publish" then action.metadata["via"] == "revision" ? + "node_actions.revision_restored" : + "node_actions.revision_published" + end + next unless key + + badge = h(t(key, :date => action.occurred_at.strftime("%Y-%m-%d"), + :actor => action.actor_name)) + if action.inferred_from + badge = safe_join([badge, content_tag(:span, t("node_actions.backfilled"), + :class => "node_action_inferred", + :title => action.inferred_from)], " ") + end + badge + end.compact + + return "" if badges.empty? + safe_join(["— ", safe_join(badges, " · ")]) + end + private def revision_ref action, key -- cgit v1.3