diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-07 03:48:09 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-07 03:48:09 +0200 |
| commit | 1bf719d6ac58187cf406d92a40b665d3fa6e658b (patch) | |
| tree | 214c0095fe06dd204e31285fbd16df4e07821d80 /app/controllers | |
| parent | 7b6af89509e8439fe2474e623ee97e4db67ab011 (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/controllers')
| -rw-r--r-- | app/controllers/nodes_controller.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 69aa268..a72be68 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -22,6 +22,7 @@ class NodesController < ApplicationController | |||
| 22 | 22 | ||
| 23 | def new | 23 | def new |
| 24 | @node = Node.new node_params | 24 | @node = Node.new node_params |
| 25 | @selected_kind = CccConventions::NODE_KINDS.key?(params[:kind]) ? params[:kind] : "generic" | ||
| 25 | if params.has_key?(:parent_id) | 26 | if params.has_key?(:parent_id) |
| 26 | @parent_id = params[:parent_id] | 27 | @parent_id = params[:parent_id] |
| 27 | @parent_name = Node.find(@parent_id).title | 28 | @parent_name = Node.find(@parent_id).title |
