diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-29 04:28:55 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-29 04:30:22 +0200 |
| commit | 191a77b2f7c280e00f7348507c13a173c704fcf9 (patch) | |
| tree | 56bd250c1b135f149c85ddb3be322c3f3139c9eb /app/views/layouts/admin.html.erb | |
| parent | c96fbbb701ec97f9f6c69ca0d51ed3cd895b260e (diff) | |
Restore and improve admin node search
- Admin search broke when routing-filter was removed: hardcoded /admin/search
and /admin/menu_search URLs in admin_search.js no longer matched the
locale-scoped routes. Fix by emitting locale-aware URLs from the layout
as JS variables.
- Also fixes form submission (POST -> GET, missing = on form_tag), jQuery
.attr("value") -> .val() for typeahead input reading, and template name
for Rails 8 compatibility.
- Adds a visible "search" link to the admin menu so editors can discover
the feature without knowing the Alt+F shortcut. Search results now show
node path alongside title and link directly to the edit view.
Named route admin_menu_search added to routes.rb.
Diffstat (limited to 'app/views/layouts/admin.html.erb')
| -rw-r--r-- | app/views/layouts/admin.html.erb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 890aeaa..c1cada3 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -13,6 +13,10 @@ | |||
| 13 | <link rel="stylesheet" href="/stylesheets/admin.css"> | 13 | <link rel="stylesheet" href="/stylesheets/admin.css"> |
| 14 | <script src="/javascripts/admin_search.js"></script> | 14 | <script src="/javascripts/admin_search.js"></script> |
| 15 | <script src="/javascripts/admin_interface.js"></script> | 15 | <script src="/javascripts/admin_interface.js"></script> |
| 16 | <script> | ||
| 17 | var ADMIN_SEARCH_URL = "<%= admin_search_path %>"; | ||
| 18 | var ADMIN_MENU_SEARCH_URL = "<%= admin_menu_search_path %>"; | ||
| 19 | </script> | ||
| 16 | </head> | 20 | </head> |
| 17 | 21 | ||
| 18 | <body> | 22 | <body> |
| @@ -41,7 +45,7 @@ | |||
| 41 | 45 | ||
| 42 | <div id="search_widget" style="display: none;"> | 46 | <div id="search_widget" style="display: none;"> |
| 43 | <div> | 47 | <div> |
| 44 | <% form_tag admin_search_path do %> | 48 | <%= form_tag admin_search_path, method: :get do %> |
| 45 | <span>Search: </span><%= text_field_tag :search_term %> | 49 | <span>Search: </span><%= text_field_tag :search_term %> |
| 46 | <% end %> | 50 | <% end %> |
| 47 | </div> | 51 | </div> |
