Add search link when no results are found on index

master
Guillaume Dott 2015-11-13 12:38:49 +01:00
parent 484e63f7ee
commit bf776ce55e
2 changed files with 10 additions and 0 deletions

View File

@ -7,5 +7,9 @@ module Librarix
'default' 'default'
end end
end end
def maybe_search?(movies)
movies.empty? && params.key?('title')
end
end end
end end

View File

@ -17,3 +17,9 @@ form method="get" action="/" id="filter"
== slim :list, locals: {movies: movies} == slim :list, locals: {movies: movies}
- if maybe_search?(movies)
p
| Search for
strong
a<> href="#{url("/search?search=#{params['title']}")}" = params['title']
| ?