From 46df266c36334170086f081a6a83a5cbb1eae5c4 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 10 Apr 2021 00:37:05 -0700 Subject: [PATCH] Fix search filters being overwritten by others --- src/invidious/views/search.ecr | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index da45e8c7..0ed47ede 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -13,7 +13,13 @@

<%= translate(locale, "filter") %>

-
+ + + <% filter_params = env.request.query_params.to_s.gsub(/q=.+?(?=&)/, "") %> + <% base_url = "/search?q=#{HTML.escape(query.not_nil!)}" %> + +
<%= translate(locale, "date") %>
<% ["hour", "today", "week", "month", "year"].each do |date| %> @@ -21,14 +27,15 @@ <% if operator_hash.fetch("date", "all") == date %> <%= translate(locale, date) %> <% else %> - + "> <%= translate(locale, date) %> <% end %>
<% end %>
-
+ +
<%= translate(locale, "content_type") %>
<% ["video", "channel", "playlist", "movie", "show"].each do |content_type| %> @@ -36,14 +43,15 @@ <% if operator_hash.fetch("content_type", "all") == content_type %> <%= translate(locale, content_type) %> <% else %> - + "> <%= translate(locale, content_type) %> <% end %>
<% end %>
-
+ +
<%= translate(locale, "duration") %>
<% ["short", "long"].each do |duration| %> @@ -51,14 +59,15 @@ <% if operator_hash.fetch("duration", "all") == duration %> <%= translate(locale, duration) %> <% else %> - + "> <%= translate(locale, duration) %> <% end %>
<% end %>
-
+ +
<%= translate(locale, "features") %>
<% ["hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr"].each do |feature| %> @@ -66,18 +75,19 @@ <% if operator_hash.fetch("features", "all").includes?(feature) %> <%= translate(locale, feature) %> <% elsif operator_hash.has_key?("features") %> - "> + "> <%= translate(locale, feature) %> <% else %> - + "> <%= translate(locale, feature) %> <% end %>
<% end %>
-
+ +
<%= translate(locale, "sort") %>
<% ["relevance", "rating", "date", "views"].each do |sort| %> @@ -85,7 +95,7 @@ <% if operator_hash.fetch("sort", "relevance") == sort %> <%= translate(locale, sort) %> <% else %> - + "> <%= translate(locale, sort) %> <% end %>