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 /public | |
| 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 'public')
| -rw-r--r-- | public/javascripts/admin_search.js | 18 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 2565929..6ef9087 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -208,14 +208,20 @@ parent_search = { | |||
| 208 | }, | 208 | }, |
| 209 | 209 | ||
| 210 | initialize_radio_buttons : function() { | 210 | initialize_radio_buttons : function() { |
| 211 | $("input[name='kind']").bind("change", function(){ | 211 | parent_search.sync_parent_field(); |
| 212 | if ($(this).val() === "generic") { | 212 | $("input[name='kind']").bind("change", function() { |
| 213 | $("#parent_search_field").show(); | 213 | parent_search.sync_parent_field(); |
| 214 | } else { | ||
| 215 | $("#parent_search_field").hide(); | ||
| 216 | } | ||
| 217 | parent_search.update_resulting_path(); | 214 | parent_search.update_resulting_path(); |
| 218 | }); | 215 | }); |
| 216 | }, | ||
| 217 | |||
| 218 | sync_parent_field : function() { | ||
| 219 | var kind = $("input[name='kind']:checked").val(); | ||
| 220 | if (kind === "generic") { | ||
| 221 | $("#parent_search_field").show(); | ||
| 222 | } else { | ||
| 223 | $("#parent_search_field").hide(); | ||
| 224 | } | ||
| 219 | } | 225 | } |
| 220 | } | 226 | } |
| 221 | 227 | ||
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 1196d83..3033798 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -338,6 +338,14 @@ input[type=radio] { | |||
| 338 | border: 1px solid #989898; | 338 | border: 1px solid #989898; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | .add_child_links { | ||
| 342 | margin-top: 0.5rem; | ||
| 343 | } | ||
| 344 | |||
| 345 | .add_child_links a { | ||
| 346 | white-space: nowrap; | ||
| 347 | } | ||
| 348 | |||
| 341 | div#login_form input[type=text], div#login_form input[type=password] { | 349 | div#login_form input[type=text], div#login_form input[type=password] { |
| 342 | width: 150px; | 350 | width: 150px; |
| 343 | } | 351 | } |
