diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-05 21:51:15 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-05 21:51:15 +0200 |
| commit | 51d491a3d67e8c9efde8019ecb8a8e1a8195ec99 (patch) | |
| tree | 6ed5d4efa659759aefcb1c4bcbd3cc21d12a7e79 /config | |
| parent | 1fa2f3821497d5529a6753cee84cf5ca679e8bcc (diff) | |
Add erfa/chaostreff node-kind creation conventions
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.
Node gains a default_template_name column (migration, with backfill
for existing update-tree nodes via node.update? - reusing that method
rather than re-deriving its unique_path check in raw SQL). Page#set_template
now inherits from node.default_template_name, falling back to the old
update?-based check only when the column is blank, and only fills in
template_name when nothing's already been explicitly chosen - a
deliberate change from the previous behavior, which unconditionally
overwrote template_name on every save regardless of manual selection.
Node#update? itself is unchanged and still used as-is by
admin_controller's sitemap filtering - a genuinely different, still
valid use of that check.
"generic" stays special-cased in the controller, parametrized by
params[:parent_id] at request time - doesn't fit "kind implies a fixed
lookup" and isn't in the registry.
nodes#new's four hardcoded radio buttons and nodes_controller's
kind-specific case/when branches are both replaced by iterating/looking
up this one registry - adding a new kind now means one new hash entry,
not four scattered edits.
Diffstat (limited to 'config')
| -rw-r--r-- | config/routes.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/routes.rb b/config/routes.rb index a7775b3..cf4733c 100644 --- a/config/routes.rb +++ b/config/routes.rb | |||
| @@ -31,6 +31,10 @@ Cccms::Application.routes.draw do | |||
| 31 | end | 31 | end |
| 32 | 32 | ||
| 33 | resources :nodes do | 33 | resources :nodes do |
| 34 | collection do | ||
| 35 | get :parameterize_preview | ||
| 36 | end | ||
| 37 | |||
| 34 | member do | 38 | member do |
| 35 | put :unlock | 39 | put :unlock |
| 36 | put :publish | 40 | put :publish |
