aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/shared_searches_controller.rb3
-rw-r--r--app/views/shared_searches/index.html.erb4
2 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/shared_searches_controller.rb b/app/controllers/shared_searches_controller.rb
index 7b1005e..dd33bc5 100644
--- a/app/controllers/shared_searches_controller.rb
+++ b/app/controllers/shared_searches_controller.rb
@@ -4,7 +4,8 @@ class SharedSearchesController < ApplicationController
skip_before_action :user_authenticated!, only: %i[show]
def index
- @searches = Search.where(shared: true).order(:name)
+ @searches = Search.order(:name)
+ @saved_searches = @searches.where(shared: true)
end
def show
diff --git a/app/views/shared_searches/index.html.erb b/app/views/shared_searches/index.html.erb
index a17537c..f9d3289 100644
--- a/app/views/shared_searches/index.html.erb
+++ b/app/views/shared_searches/index.html.erb
@@ -3,11 +3,11 @@
<div>
<h3><%= I18n.t('searches.shared.title') %></h3>
- <% if @searches.empty? %>
+ <% if @saved_searches.empty? %>
<div><span><%= I18n.t('searches.shared.none') %>.</span></div>
<% else %>
<div id="shared-searches-list">
- <% @searches.each do |s| %>
+ <% @saved_searches.each do |s| %>
<div>
<%= link_to s.name, search_shared_path(s) %>
</div>