diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-18 02:16:23 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-18 02:16:23 +0200 |
| commit | d85c7998e5faa0da53514bae8cc2ccb9a9fe0cd3 (patch) | |
| tree | e29ebcdfa5361682f0dc73c928d8d35f0fc9533f | |
| parent | d41ee504caedbe858e24ab2a23c7a804454c64c8 (diff) | |
Teach the action log reader the Trash vocabulary
Sentences for trash (with the pre-trash path), restore_from_trash
(with the destination), and destroy (with the final path, read
from its flat create-symmetric key).
| -rw-r--r-- | app/helpers/node_actions_helper.rb | 15 | ||||
| -rw-r--r-- | config/locales/de.yml | 3 | ||||
| -rw-r--r-- | config/locales/en.yml | 3 | ||||
| -rw-r--r-- | test/models/helpers/node_actions_helper_test.rb | 10 |
4 files changed, 31 insertions, 0 deletions
diff --git a/app/helpers/node_actions_helper.rb b/app/helpers/node_actions_helper.rb index 996f98d..c829dff 100644 --- a/app/helpers/node_actions_helper.rb +++ b/app/helpers/node_actions_helper.rb | |||
| @@ -114,4 +114,19 @@ module NodeActionsHelper | |||
| 114 | t("node_actions.destroy_draft", | 114 | t("node_actions.destroy_draft", |
| 115 | :actor => actor_ref(action), :subject => subject_ref(action)).html_safe | 115 | :actor => actor_ref(action), :subject => subject_ref(action)).html_safe |
| 116 | end | 116 | end |
| 117 | |||
| 118 | def summarize_trash action | ||
| 119 | t("node_actions.trash", :actor => actor_ref(action), :subject => subject_ref(action), | ||
| 120 | :from => h(action.metadata.dig("path", "from"))).html_safe | ||
| 121 | end | ||
| 122 | |||
| 123 | def summarize_restore_from_trash action | ||
| 124 | t("node_actions.restore_from_trash", :actor => actor_ref(action), :subject => subject_ref(action), | ||
| 125 | :to => h(action.metadata.dig("path", "to"))).html_safe | ||
| 126 | end | ||
| 127 | |||
| 128 | def summarize_destroy action | ||
| 129 | t("node_actions.destroy", :actor => actor_ref(action), :subject => subject_ref(action), | ||
| 130 | :path => h(action.metadata["path"])).html_safe | ||
| 131 | end | ||
| 117 | end | 132 | end |
diff --git a/config/locales/de.yml b/config/locales/de.yml index 8592364..289e5cc 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml | |||
| @@ -110,3 +110,6 @@ de: | |||
| 110 | detail_tags: "Tags %{from} → %{to}" | 110 | detail_tags: "Tags %{from} → %{to}" |
| 111 | template_changed: "Template geändert" | 111 | template_changed: "Template geändert" |
| 112 | assets_changed: "Bildliste geändert" | 112 | assets_changed: "Bildliste geändert" |
| 113 | trash: "%{actor} hat %{subject} in den Papierkorb verschoben (vorher unter %{from})" | ||
| 114 | restore_from_trash: "%{actor} hat %{subject} aus dem Papierkorb nach %{to} wiederhergestellt" | ||
| 115 | destroy: "%{actor} hat %{subject} endgültig gelöscht (zuletzt unter %{path})" | ||
diff --git a/config/locales/en.yml b/config/locales/en.yml index f1856c1..b356cc1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml | |||
| @@ -62,3 +62,6 @@ en: | |||
| 62 | detail_tags: "tags %{from} → %{to}" | 62 | detail_tags: "tags %{from} → %{to}" |
| 63 | template_changed: "template changed" | 63 | template_changed: "template changed" |
| 64 | assets_changed: "attached images changed" | 64 | assets_changed: "attached images changed" |
| 65 | trash: "%{actor} moved %{subject} to the Trash (was at %{from})" | ||
| 66 | restore_from_trash: "%{actor} restored %{subject} from the Trash to %{to}" | ||
| 67 | destroy: "%{actor} permanently deleted %{subject} (last at %{path})" | ||
diff --git a/test/models/helpers/node_actions_helper_test.rb b/test/models/helpers/node_actions_helper_test.rb index 5244c19..16c833b 100644 --- a/test/models/helpers/node_actions_helper_test.rb +++ b/test/models/helpers/node_actions_helper_test.rb | |||
| @@ -104,4 +104,14 @@ class NodeActionsHelperTest < ActionView::TestCase | |||
| 104 | assert_includes action_summary(e), "a/b" | 104 | assert_includes action_summary(e), "a/b" |
| 105 | assert_not action_details?(e) | 105 | assert_not action_details?(e) |
| 106 | end | 106 | end |
| 107 | |||
| 108 | test "trash, restore, and destroy render their paths" do | ||
| 109 | trash = entry("trash", { "path" => { "from" => "club/old", "to" => "trash/old" } }) | ||
| 110 | restore = entry("restore_from_trash", { "path" => { "from" => "trash/old", "to" => "club/new" } }) | ||
| 111 | doomed = entry("destroy", { "path" => "trash/old" }) | ||
| 112 | |||
| 113 | assert_includes action_summary(trash), "club/old" | ||
| 114 | assert_includes action_summary(restore), "club/new" | ||
| 115 | assert_includes action_summary(doomed), "trash/old" | ||
| 116 | end | ||
| 107 | end | 117 | end |
