diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-12 13:58:36 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-12 13:58:36 +0200 |
| commit | 19e0ee821d5b2b6d3397a81411f4f3a4cbd2fa83 (patch) | |
| tree | 952551d861bb8348d436367e8f048c5f85853cf5 /app/views | |
| parent | 45bf65d04d046c0ea4a1150096b2a9b846d6c0b8 (diff) | |
Unify the four field-level pickers, fix search visibility
menu_items/parent_search/move_to_search/event_search each duplicated
their own debounce-free AJAX call and result rendering. Replaced with
one shared initSearchPicker, taking each picker's distinctive
behavior (parent_search's live path preview, event_search's title
hint) as a callback rather than a whole reimplementation. Adds a real
debounce with an out-of-order-response guard -- none of the four had
either before. admin_search (the Alt+F top-bar search) now shares the
same function via its own url/isActive/header options, gaining the
same guard and fixing an inconsistency of its own (it previously
always slid its panel open, even on zero results).
Each picker's results container gets its own id instead of sharing
was ever supposed to be on screen at once, an assumption with no
actual enforcement behind it. Styling moved from an id-pair
(#menu_search_results, #search_results) to a shared .search_results
class so a future picker never needs this file touched again.
menu_search and the admin top-bar search now call Node.editor_search
instead of the public, head-only Node.search -- both are admin-only,
authenticated views, and had no reason to inherit the public search's
"can't find a draft" limitation. The always-ignored :per_page => 1000
on the latter is gone too; Node.search's second argument was never
read by the method at all.
Also removed a stale #metadata a { text-transform: lowercase } rule,
found while verifying the above -- written for the pre-subnav-removal
expand-toggle, which no longer exists; it had been silently
lowercasing nodes#edit's own, unrelated #metadata div (including
move_to_search's results) by id coincidence ever since. #main_navigation
and #overview_toggle intentionally left capitalized rather than
special-cased -- both belong to the nav bar already slated to shrink
to three icons, not worth polishing on the way out.
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/events/edit.html.erb | 4 | ||||
| -rw-r--r-- | app/views/events/new.html.erb | 2 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.erb | 4 | ||||
| -rw-r--r-- | app/views/menu_items/edit.html.erb | 2 | ||||
| -rw-r--r-- | app/views/menu_items/new.html.erb | 4 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 14 | ||||
| -rw-r--r-- | app/views/nodes/new.html.erb | 2 |
7 files changed, 13 insertions, 19 deletions
diff --git a/app/views/events/edit.html.erb b/app/views/events/edit.html.erb index 6cb04bd7..45b084f0 100644 --- a/app/views/events/edit.html.erb +++ b/app/views/events/edit.html.erb | |||
| @@ -19,12 +19,12 @@ | |||
| 19 | <details> | 19 | <details> |
| 20 | <summary>Change node</summary> | 20 | <summary>Change node</summary> |
| 21 | <%= text_field_tag :event_node_search_term %> | 21 | <%= text_field_tag :event_node_search_term %> |
| 22 | <div id="search_results"></div> | 22 | <div id="event_search_results" class="search_results"></div> |
| 23 | <span class="field_hint">This will re-link the event to a different node — rarely needed.</span> | 23 | <span class="field_hint">This will re-link the event to a different node — rarely needed.</span> |
| 24 | </details> | 24 | </details> |
| 25 | <% else %> | 25 | <% else %> |
| 26 | <%= text_field_tag :event_node_search_term %> | 26 | <%= text_field_tag :event_node_search_term %> |
| 27 | <div id="search_results"></div> | 27 | <div id="event_search_results" class="search_results"></div> |
| 28 | <span class="field_hint">Optional — search and pick a node to associate this event with a page.</span> | 28 | <span class="field_hint">Optional — search and pick a node to associate this event with a page.</span> |
| 29 | <% end %> | 29 | <% end %> |
| 30 | <%= f.hidden_field :node_id %> | 30 | <%= f.hidden_field :node_id %> |
diff --git a/app/views/events/new.html.erb b/app/views/events/new.html.erb index b20fe488..7a1ee7a3 100644 --- a/app/views/events/new.html.erb +++ b/app/views/events/new.html.erb | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | <div class="node_description">Node</div> | 10 | <div class="node_description">Node</div> |
| 11 | <div class="node_content"> | 11 | <div class="node_content"> |
| 12 | <%= text_field_tag :event_node_search_term %> | 12 | <%= text_field_tag :event_node_search_term %> |
| 13 | <div id="search_results"></div> | 13 | <div id="event_search_results" class="search_results"></div> |
| 14 | <%= f.hidden_field :node_id %> | 14 | <%= f.hidden_field :node_id %> |
| 15 | <span class="field_hint">Optional — search and pick a node to associate this event with a page.</span> | 15 | <span class="field_hint">Optional — search and pick a node to associate this event with a page.</span> |
| 16 | </div> | 16 | </div> |
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index e714c281..079346b2 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -56,9 +56,7 @@ | |||
| 56 | <span>Search: </span><%= text_field_tag :search_term, nil, autocomplete: "off" %> | 56 | <span>Search: </span><%= text_field_tag :search_term, nil, autocomplete: "off" %> |
| 57 | <% end %> | 57 | <% end %> |
| 58 | </div> | 58 | </div> |
| 59 | <div id="menu_search_results" style="display: none"> | 59 | <div id="menu_search_results" class="search_results" style="display: none"></div> |
| 60 | |||
| 61 | </div> | ||
| 62 | </div> | 60 | </div> |
| 63 | </body> | 61 | </body> |
| 64 | </html> | 62 | </html> |
diff --git a/app/views/menu_items/edit.html.erb b/app/views/menu_items/edit.html.erb index dc5e8f97..44e5a791 100644 --- a/app/views/menu_items/edit.html.erb +++ b/app/views/menu_items/edit.html.erb | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | <div class="node_description">Search</div> | 6 | <div class="node_description">Search</div> |
| 7 | <div class="node_content"> | 7 | <div class="node_content"> |
| 8 | <%= text_field_tag :menu_search_term %> | 8 | <%= text_field_tag :menu_search_term %> |
| 9 | <div id="search_results"></div> | 9 | <div id="menu_item_search_results" class="search_results"></div> |
| 10 | </div> | 10 | </div> |
| 11 | 11 | ||
| 12 | <div class="node_description">Node Id</div> | 12 | <div class="node_description">Node Id</div> |
diff --git a/app/views/menu_items/new.html.erb b/app/views/menu_items/new.html.erb index 68081d0f..223cb8ec 100644 --- a/app/views/menu_items/new.html.erb +++ b/app/views/menu_items/new.html.erb | |||
| @@ -7,9 +7,7 @@ | |||
| 7 | <td class="description">Search</td> | 7 | <td class="description">Search</td> |
| 8 | <td> | 8 | <td> |
| 9 | <%= text_field_tag :menu_search_term %> | 9 | <%= text_field_tag :menu_search_term %> |
| 10 | <div id="search_results"> | 10 | <div id="menu_item_search_results" class="search_results"></div> |
| 11 | |||
| 12 | </div> | ||
| 13 | </td> | 11 | </td> |
| 14 | </tr> | 12 | </tr> |
| 15 | <tr> | 13 | <tr> |
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 1c194101..13b78fca 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -45,14 +45,12 @@ | |||
| 45 | <div class="node_description">parent</div> | 45 | <div class="node_description">parent</div> |
| 46 | <div class="node_content"> | 46 | <div class="node_content"> |
| 47 | <%= text_field_tag :move_to_search_term, @node.parent.title rescue "" %> | 47 | <%= text_field_tag :move_to_search_term, @node.parent.title rescue "" %> |
| 48 | <div id="search_results"> | 48 | <div id="move_to_search_results" class="search_results"></div> |
| 49 | 49 | <%= f.hidden_field( | |
| 50 | </div> | 50 | :staged_parent_id, |
| 51 | <%= f.hidden_field( | 51 | :value => @node.staged_parent_id || @node.parent_id |
| 52 | :staged_parent_id, | 52 | ) |
| 53 | :value => @node.staged_parent_id || @node.parent_id | 53 | %> |
| 54 | ) | ||
| 55 | %> | ||
| 56 | </div> | 54 | </div> |
| 57 | 55 | ||
| 58 | <%= fields_for @page do |d| %> | 56 | <%= fields_for @page do |d| %> |
diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb index afc632f9..bb7e078a 100644 --- a/app/views/nodes/new.html.erb +++ b/app/views/nodes/new.html.erb | |||
| @@ -34,7 +34,7 @@ | |||
| 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 %> |
| 36 | <%= hidden_field_tag :parent_id, @parent_id %> | 36 | <%= hidden_field_tag :parent_id, @parent_id %> |
| 37 | <div id="search_results"></div> | 37 | <div id="parent_search_results" class="search_results"></div> |
| 38 | </div> | 38 | </div> |
| 39 | </div> | 39 | </div> |
| 40 | 40 | ||
