From 6b6e50909cc77de1797e88be5445c5b643b008a9 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 18 Jul 2026 15:28:30 +0200 Subject: Give action log entries per-verb icons A muted glyph before each sentence makes both log surfaces scannable by verb: create, publish, move, trash, restore, destroy, and the discard pair. Rollback publishes get their own icon (history) distinct from ordinary promotion. Unknown verbs fall back to a dashed circle. --- app/helpers/node_actions_helper.rb | 25 +++++++++++++++++++++++++ app/views/node_actions/_action_row.html.erb | 1 + 2 files changed, 26 insertions(+) (limited to 'app') diff --git a/app/helpers/node_actions_helper.rb b/app/helpers/node_actions_helper.rb index eb761e3..fd8cc36 100644 --- a/app/helpers/node_actions_helper.rb +++ b/app/helpers/node_actions_helper.rb @@ -1,6 +1,31 @@ module NodeActionsHelper include ERB::Util + # One glyph per verb, rendered before the sentence in _action_row. + # Unknown verbs get the dashed circle -- the unknown-verb principle + # extended to iconography: the log outlives its vocabulary. + VERB_ICONS = { + "create" => "file-plus", + "publish" => "send", + "move" => "arrows-move", + "trash" => "trash", + "restore_from_trash" => "arrow-back-up", + "destroy" => "trash-x", + "discard_autosave" => "eraser", + "destroy_draft" => "eraser", + }.freeze + + def verb_icon action + name = if action.action == "publish" && action.metadata["via"] == "revision" + "history" + else + VERB_ICONS.fetch(action.action, "circle-dashed") + end + content_tag(:span, icon(name, library: "tabler", "aria-hidden": true), + :class => "node_action_icon node_action_icon--#{name}", + :title => action.action) + end + # One sentence per entry, rendered from metadata alone, so entries # stay renderable after the rows they reference are gone. Live # associations only upgrade plain names to links. Every metadata diff --git a/app/views/node_actions/_action_row.html.erb b/app/views/node_actions/_action_row.html.erb index 5b5488b..c640f0d 100644 --- a/app/views/node_actions/_action_row.html.erb +++ b/app/views/node_actions/_action_row.html.erb @@ -4,6 +4,7 @@ <%= action.occurred_at.strftime("%H:%M") %> + <%= verb_icon(action) %> <%= action_summary(action) %> <% if action.node_id && params[:node_id].blank? %> <%= link_to t("node_actions.node_history"), admin_log_path(:node_id => action.node_id), :class => "node_action_zoom" %> -- cgit v1.3