From 5c0508d91cf1ecc85cfc38b152f676add907404d Mon Sep 17 00:00:00 2001 From: Adrien Maston Date: Wed, 18 Feb 2026 18:19:37 +0100 Subject: [PATCH] Don't show "no match" when not searching anything yet --- app/assets/stylesheets/search.css | 5 +++++ app/views/searches/show.html.erb | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/search.css b/app/assets/stylesheets/search.css index 5691ac5e5..32dec66b3 100644 --- a/app/assets/stylesheets/search.css +++ b/app/assets/stylesheets/search.css @@ -129,4 +129,9 @@ summary { padding-inline: 0; } } + .search-perma--empty { + .search { + display: none; + } + } } diff --git a/app/views/searches/show.html.erb b/app/views/searches/show.html.erb index 776ab9d38..197eebab2 100644 --- a/app/views/searches/show.html.erb +++ b/app/views/searches/show.html.erb @@ -1,4 +1,4 @@ -<% @page_title = params.has_key?(:q) ? "Search results for \"#{params[:q]}\"" : "Search" %> +<% @page_title = !params[:q].blank? ? "Search results for \"#{params[:q]}\"" : "Search" %> <% content_for :header do %>
@@ -8,7 +8,7 @@

<%= @page_title %>

<% end %> -
+<%= tag.div(class: token_list("search-perma", {"search-perma--empty": params[:q].blank?}, "margin-block-start")) do %> <%= render "form", query_terms: params[:q] %> <%= turbo_frame_tag "bar_content" do %> <% if @card %> @@ -17,4 +17,4 @@ <%= render "results", page: @page %> <% end %> <% end %> -
+<% end %>