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/controllers/admin_controller.rb | |
| 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/controllers/admin_controller.rb')
| -rw-r--r-- | app/controllers/admin_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9e8564e..1a94a77 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -35,12 +35,12 @@ class AdminController < ApplicationController | |||
| 35 | 35 | ||
| 36 | respond_to do |format| | 36 | respond_to do |format| |
| 37 | format.html do | 37 | format.html do |
| 38 | render :template => 'admin/search_results.html' | 38 | render :template => 'admin/search_results' |
| 39 | end | 39 | end |
| 40 | format.js do | 40 | format.js do |
| 41 | render( :json => @results.map do |node| | 41 | render( :json => @results.map do |node| |
| 42 | if node | 42 | if node |
| 43 | {:id => node.id, :title => node.title, :edit_path => node_path(node)} | 43 | {:id => node.id, :title => " #{node.title} (#{node.unique_name})", :edit_path => edit_node_path(node)} |
| 44 | end | 44 | end |
| 45 | end | 45 | end |
| 46 | ) | 46 | ) |
