summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-07 03:48:09 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-07 03:48:09 +0200
commit1bf719d6ac58187cf406d92a40b665d3fa6e658b (patch)
tree214c0095fe06dd204e31285fbd16df4e07821d80 /app/helpers
parent7b6af89509e8439fe2474e623ee97e4db67ab011 (diff)
Add context-aware child-creation shortcuts to nodes#show
parent_match Procs on CccConventions::NODE_KINDS, matched against unique_path, decide which "add child" kinds show on a given node. Fixes nodes#new not honoring a pre-selected kind (radio group and parent-field visibility both defaulted to "generic" unconditionally).
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/nodes_helper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb
index 2baf813..a89f879 100644
--- a/app/helpers/nodes_helper.rb
+++ b/app/helpers/nodes_helper.rb
@@ -58,4 +58,9 @@ module NodesHelper
58 t(:event_schedule_none) 58 t(:event_schedule_none)
59 end 59 end
60 end 60 end
61
62 def matching_node_kinds(node)
63 path = node.unique_path
64 CccConventions::NODE_KINDS.select { |_, config| config[:parent_match]&.call(path) }
65 end
61end 66end