From 4c47031f9693fc04b01cbb005ad864cd1e3d2425 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 6 Jul 2026 04:15:46 +0200 Subject: Add erfa/chaostreff node-kind creation conventions, part 2 The following changes were already announced in the last commit, but the files forgotten. Here's them actually attached. lib/ccc_conventions.rb: NODE_KINDS registry replaces the kind-specific branches previously scattered across nodes_controller#create (tags), unique_path-position check). Each kind declares its parent lookup (a Proc - Update's "update"/"press_release" continue to genuinely find-or-create their year-folder via Update.find_or_create_parent; erfa/chaostreff use a plain find_by_unique_name!, since their parent nodes are fixed and a missing one should fail loudly, not be silently created), its tags, and (new) its default template. New read-only admin/conventions view dumps the NODE_KINDS registry as a reference table for whoever's confused later about how a given kind behaves - deliberately just renders the same label/hint text used on nodes#new rather than re-describing parent/tags/template separately, since decomposing the parent Proc would mean either invoking it (Update's has a real side effect - creates the year folder) or re-stating its logic a second time in a different shape, either of which risks drifting from the actual behavior. --- app/views/admin/conventions.html.erb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/views/admin/conventions.html.erb (limited to 'app') diff --git a/app/views/admin/conventions.html.erb b/app/views/admin/conventions.html.erb new file mode 100644 index 0000000..72f6214 --- /dev/null +++ b/app/views/admin/conventions.html.erb @@ -0,0 +1,11 @@ +

Node creation conventions

+ + + + <% @node_kinds.each do |kind, config| %> + + + + + <% end %> +
KindWhat happens
<%= kind %><%= resolve_kind_text(config[:label]) %> — <%= resolve_kind_text(config[:hint]) %>
-- cgit v1.3