diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-17 03:11:37 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-17 03:11:37 +0200 |
| commit | 0e15d4461cc9b8e8baeeab2288ef8bbc2d30c3e6 (patch) | |
| tree | c17d96f4767d31afe7738659a265cc461a671505 | |
| parent | 8570051876b86c08d4b72288f8598f0e0d2335e1 (diff) | |
Toggle the search widget from a button
| -rw-r--r-- | app/views/layouts/_nav_controls.html.erb | 4 | ||||
| -rw-r--r-- | public/javascripts/admin_interface.js | 9 | ||||
| -rw-r--r-- | public/javascripts/admin_search.js | 2 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 7 |
4 files changed, 20 insertions, 2 deletions
diff --git a/app/views/layouts/_nav_controls.html.erb b/app/views/layouts/_nav_controls.html.erb index 66524044..44010eb6 100644 --- a/app/views/layouts/_nav_controls.html.erb +++ b/app/views/layouts/_nav_controls.html.erb | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | 1 | ||
| 2 | <% if current_user %> | 2 | <% if current_user %> |
| 3 | <%= link_to icon("home", library: "tabler", "aria-hidden": true), admin_path, "aria-label": t(".dashboard"), title: t(".dashboard") %> | 3 | <%= link_to icon("home", library: "tabler", "aria-hidden": true), admin_path, "aria-label": t(".dashboard"), title: t(".dashboard") %> |
| 4 | <a href="#" onclick="admin_search.display_toggle(); return false;" aria-label="<%= t(".search") %>" title="<%= t(".search") %>"><%= icon("search", library: "tabler", "aria-hidden": true) %></a> | 4 | <button type="button" id="search_toggle" class="nav_toggle" aria-label="<%= t(".search") %>" title="<%= t(".search") %>"> |
| 5 | <%= icon("search", library: "tabler", "aria-hidden": true) %> | ||
| 6 | </button> | ||
| 5 | <% end %> | 7 | <% end %> |
| 6 | <%= link_to root_path, class: "nav_toggle", | 8 | <%= link_to root_path, class: "nav_toggle", |
| 7 | "aria-label" => t(".public_site"), title: t(".public_site") do %> | 9 | "aria-label" => t(".public_site"), title: t(".public_site") do %> |
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index abe434bf..994d3698 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -58,6 +58,15 @@ $(document).ready(function () { | |||
| 58 | } | 58 | } |
| 59 | }); | 59 | }); |
| 60 | 60 | ||
| 61 | if ($("#search_toggle").length != 0) { | ||
| 62 | var search_toggle = document.getElementById('search_toggle'); | ||
| 63 | search_toggle.addEventListener('click', function (e) { | ||
| 64 | admin_search.display_toggle(); | ||
| 65 | e.preventDefault(); | ||
| 66 | console.log("Toggle"); | ||
| 67 | }); | ||
| 68 | } | ||
| 69 | |||
| 61 | if ($("#dashboard_search_term").length != 0) { | 70 | if ($("#dashboard_search_term").length != 0) { |
| 62 | dashboard_search.initialize(); | 71 | dashboard_search.initialize(); |
| 63 | } | 72 | } |
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 8c86a74f..e20e511a 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -14,7 +14,7 @@ admin_search = { | |||
| 14 | $(document).bind("click", function(e) { | 14 | $(document).bind("click", function(e) { |
| 15 | if ($('#search_widget').is(':visible') && | 15 | if ($('#search_widget').is(':visible') && |
| 16 | !$(e.target).closest('#search_widget').length && | 16 | !$(e.target).closest('#search_widget').length && |
| 17 | !$(e.target).closest('a[onclick*="display_toggle"]').length) { | 17 | !$(e.target).closest('#search_toggle').length) { |
| 18 | $('#search_widget').fadeOut(); | 18 | $('#search_widget').fadeOut(); |
| 19 | } | 19 | } |
| 20 | }); | 20 | }); |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index fec27ca1..923cac4b 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -481,6 +481,7 @@ input[type="submit"]:hover { | |||
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | #main_navigation a, | 483 | #main_navigation a, |
| 484 | #main_navigation button, | ||
| 484 | #main_navigation label.nav_toggle, | 485 | #main_navigation label.nav_toggle, |
| 485 | #main_navigation form.button_to button { | 486 | #main_navigation form.button_to button { |
| 486 | display: inline-flex; | 487 | display: inline-flex; |
| @@ -491,10 +492,12 @@ input[type="submit"]:hover { | |||
| 491 | width: 2.75rem; | 492 | width: 2.75rem; |
| 492 | height: 2.75rem; | 493 | height: 2.75rem; |
| 493 | padding: 0; | 494 | padding: 0; |
| 495 | border-color: transparent; | ||
| 494 | border-radius: var(--radius-control); | 496 | border-radius: var(--radius-control); |
| 495 | } | 497 | } |
| 496 | 498 | ||
| 497 | #main_navigation a:hover, | 499 | #main_navigation a:hover, |
| 500 | #main_navigation button:hover, | ||
| 498 | #main_navigation label.nav_toggle:hover { | 501 | #main_navigation label.nav_toggle:hover { |
| 499 | color: var(--surface); | 502 | color: var(--surface); |
| 500 | background-color: var(--text); | 503 | background-color: var(--text); |
| @@ -504,6 +507,10 @@ input[type="submit"]:hover { | |||
| 504 | cursor: pointer; | 507 | cursor: pointer; |
| 505 | } | 508 | } |
| 506 | 509 | ||
| 510 | #main_navigation button#search_toggle { | ||
| 511 | cursor: zoom-in; | ||
| 512 | } | ||
| 513 | |||
| 507 | #main_navigation svg { | 514 | #main_navigation svg { |
| 508 | width: 1.5rem; | 515 | width: 1.5rem; |
| 509 | height: 1.5rem; | 516 | height: 1.5rem; |
