summaryrefslogtreecommitdiff
path: root/app/views/nodes/new.html.erb
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/views/nodes/new.html.erb
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/views/nodes/new.html.erb')
-rw-r--r--app/views/nodes/new.html.erb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb
index 0a053250..71f2fbf1 100644
--- a/app/views/nodes/new.html.erb
+++ b/app/views/nodes/new.html.erb
@@ -13,7 +13,7 @@
13 <div class="node_content"> 13 <div class="node_content">
14 <% CccConventions::NODE_KINDS.each do |kind, config| %> 14 <% CccConventions::NODE_KINDS.each do |kind, config| %>
15 <p> 15 <p>
16 <%= radio_button_tag :kind, kind, kind == "generic", 16 <%= radio_button_tag :kind, kind, kind == @selected_kind,
17 data: { path_prefix: resolve_kind_text(config[:path_prefix]) } %> 17 data: { path_prefix: resolve_kind_text(config[:path_prefix]) } %>
18 <%= resolve_kind_text(config[:label]) %> 18 <%= resolve_kind_text(config[:label]) %>
19 <% if config[:hint] %> 19 <% if config[:hint] %>
@@ -29,7 +29,7 @@
29 <span class="field_hint">A URL slug will be generated from this automatically. You can review or adjust it afterward under the "metadata" section's Slug field.</span> 29 <span class="field_hint">A URL slug will be generated from this automatically. You can review or adjust it afterward under the "metadata" section's Slug field.</span>
30 </div> 30 </div>
31 31
32 <div id="parent_search_field"> 32 <div id="parent_search_field" style="<%= @selected_kind == "generic" ? "" : "display: none;" %>">
33 <div class="node_description">Parent</div> 33 <div class="node_description">Parent</div>
34 <div class="node_content"> 34 <div class="node_content">
35 <%= text_field_tag :parent_search_term, @parent_name %> 35 <%= text_field_tag :parent_search_term, @parent_name %>