diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-20 03:32:53 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-20 03:32:53 +0200 |
| commit | d89e2de48a5e16ff01ec627e79c76b833e4618cf (patch) | |
| tree | e0d33d44932c5d3327bde5f7b618d2d7b6f76864 | |
| parent | b974b0f328113b53bf8f6e6c2703616ea9767402 (diff) | |
Link publish actions to revision diffs in recents
| -rw-r--r-- | app/models/node_action.rb | 8 | ||||
| -rw-r--r-- | app/views/node_actions/_change_details.html.erb | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/app/models/node_action.rb b/app/models/node_action.rb index 13bd5ba..63a99ae 100644 --- a/app/models/node_action.rb +++ b/app/models/node_action.rb | |||
| @@ -166,4 +166,12 @@ class NodeAction < ApplicationRecord | |||
| 166 | def subject_name | 166 | def subject_name |
| 167 | metadata["human_readable_node_name"] || node&.unique_name || "deleted node" | 167 | metadata["human_readable_node_name"] || node&.unique_name || "deleted node" |
| 168 | end | 168 | end |
| 169 | |||
| 170 | def diff_link_params | ||
| 171 | prev = NodeAction.where(node_id: node_id, action: "publish") | ||
| 172 | .where("id < ?", id) | ||
| 173 | .order(id: :desc).first | ||
| 174 | return nil unless prev&.page && page | ||
| 175 | { start_revision: prev.page.revision, end_revision: page.revision } | ||
| 176 | end | ||
| 169 | end | 177 | end |
diff --git a/app/views/node_actions/_change_details.html.erb b/app/views/node_actions/_change_details.html.erb index 2583e8b..066d0f3 100644 --- a/app/views/node_actions/_change_details.html.erb +++ b/app/views/node_actions/_change_details.html.erb | |||
| @@ -5,9 +5,13 @@ | |||
| 5 | <tr> | 5 | <tr> |
| 6 | <th><%= I18n.default_locale.to_s.upcase %></th> | 6 | <th><%= I18n.default_locale.to_s.upcase %></th> |
| 7 | <td> | 7 | <td> |
| 8 | <%= safe_join(default_items, ", ") %> | 8 | <%= safe_join(default_items, tag.br) %> |
| 9 | <% if action_entry.page && action_entry.node %> | 9 | <% if action_entry.page && action_entry.node %> |
| 10 | <%= link_to t("node_actions.view_revision"), node_revision_path(action_entry.node, action_entry.page) %> | 10 | <% if (diff_params = action_entry.diff_link_params) %> |
| 11 | <%= link_to t("node_actions.view_diff"), diff_node_revisions_path(action_entry.node, diff_params) %> | ||
| 12 | <% else %> | ||
| 13 | <%= link_to t("node_actions.view_revision"), node_revision_path(action_entry.node, action_entry.page) %> | ||
| 14 | <% end %> | ||
| 11 | <% end %> | 15 | <% end %> |
| 12 | </td> | 16 | </td> |
| 13 | </tr> | 17 | </tr> |
| @@ -16,9 +20,13 @@ | |||
| 16 | <tr> | 20 | <tr> |
| 17 | <th><%= locale.upcase %></th> | 21 | <th><%= locale.upcase %></th> |
| 18 | <td> | 22 | <td> |
| 19 | <%= safe_join(translation_changes(diff), ", ") %> | 23 | <%= safe_join(translation_changes(diff), tag.br) %> |
| 20 | <% if action_entry.page && action_entry.node %> | 24 | <% if action_entry.page && action_entry.node %> |
| 21 | <%= link_to t("node_actions.view_revision"), node_revision_path(action_entry.node, action_entry.page, :locale => locale) %> | 25 | <% if (diff_params = action_entry.diff_link_params) %> |
| 26 | <%= link_to t("node_actions.view_diff"), diff_node_revisions_path(action_entry.node, diff_params.merge(:locale => locale)) %> | ||
| 27 | <% else %> | ||
| 28 | <%= link_to t("node_actions.view_revision"), node_revision_path(action_entry.node, action_entry.page, :locale => locale) %> | ||
| 29 | <% end %> | ||
| 22 | <% end %> | 30 | <% end %> |
| 23 | </td> | 31 | </td> |
| 24 | </tr> | 32 | </tr> |
