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 | |
| 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')
| -rw-r--r-- | app/controllers/admin_controller.rb | 4 | ||||
| -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 |
8 files changed, 15 insertions, 21 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 435df57..3c45c49 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -31,7 +31,7 @@ class AdminController < ApplicationController | |||
| 31 | end | 31 | end |
| 32 | 32 | ||
| 33 | def search | 33 | def search |
| 34 | @results = Node.search params[:search_term], :per_page => 1000 | 34 | @results = Node.editor_search(params[:search_term]) |
| 35 | 35 | ||
| 36 | respond_to do |format| | 36 | respond_to do |format| |
| 37 | format.html do | 37 | format.html do |
| @@ -53,7 +53,7 @@ class AdminController < ApplicationController | |||
| 53 | if params[:search_term] == "Root" | 53 | if params[:search_term] == "Root" |
| 54 | @results = [Node.root] | 54 | @results = [Node.root] |
| 55 | else | 55 | else |
| 56 | @results = Node.search params[:search_term] | 56 | @results = Node.editor_search(params[:search_term]) |
| 57 | end | 57 | end |
| 58 | 58 | ||
| 59 | respond_to do |format| | 59 | respond_to do |format| |
diff --git a/app/views/events/edit.html.erb b/app/views/events/edit.html.erb index 6cb04bd..45b084f 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 b20fe48..7a1ee7a 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 e714c28..079346b 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 dc5e8f9..44e5a79 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 68081d0..223cb8e 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 1c19410..13b78fc 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 afc632f..bb7e078 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 | ||
