summaryrefslogtreecommitdiff
path: root/app/views/admin
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-29 04:28:55 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-29 04:30:22 +0200
commit191a77b2f7c280e00f7348507c13a173c704fcf9 (patch)
tree56bd250c1b135f149c85ddb3be322c3f3139c9eb /app/views/admin
parentc96fbbb701ec97f9f6c69ca0d51ed3cd895b260e (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/admin')
-rw-r--r--app/views/admin/_menu.html.erb1
-rw-r--r--app/views/admin/search_results.html.erb2
2 files changed, 2 insertions, 1 deletions
diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb
index 6f217eb..6dba085 100644
--- a/app/views/admin/_menu.html.erb
+++ b/app/views/admin/_menu.html.erb
@@ -1,6 +1,7 @@
1<%= language_selector %> 1<%= language_selector %>
2<%= button_to 'Logout', logout_path, method: :delete %> 2<%= button_to 'Logout', logout_path, method: :delete %>
3<%= link_to 'Overview', admin_path %> 3<%= link_to 'Overview', admin_path %>
4<a href="#" onclick="admin_search.display_toggle(); return false;">search</a>
4<%= link_to 'Nodes', nodes_path, selected?('nodes') %> 5<%= link_to 'Nodes', nodes_path, selected?('nodes') %>
5<%= link_to 'Assets', assets_path, selected?('assets') %> 6<%= link_to 'Assets', assets_path, selected?('assets') %>
6<%= link_to 'User', users_path, selected?('users') %> 7<%= link_to 'User', users_path, selected?('users') %>
diff --git a/app/views/admin/search_results.html.erb b/app/views/admin/search_results.html.erb
index 671b665..f8aece0 100644
--- a/app/views/admin/search_results.html.erb
+++ b/app/views/admin/search_results.html.erb
@@ -2,6 +2,6 @@
2 2
3<ul> 3<ul>
4<%- @results.each do |result| %> 4<%- @results.each do |result| %>
5 <li><a href="<%= node_path(result) %>"><%= result.title %></a></li> 5 <li><%= link_to "#{result.title} (#{result.unique_name})", edit_node_path(result) %></li>
6<% end %> 6<% end %>
7</ul> 7</ul>