Show search source badges only with show_sources param
The badges are a debugging aid - render them only when explicitly requested via ?show_sources=1 instead of on every search.
This commit is contained in:
parent
323b7004ed
commit
4c736096ae
3 changed files with 19 additions and 4 deletions
|
|
@ -1,4 +1,10 @@
|
|||
module PackagesHelper
|
||||
# Search result origin badges are only shown when explicitly
|
||||
# requested via ?show_sources=1
|
||||
def search_sources_visible?
|
||||
params[:show_sources].present?
|
||||
end
|
||||
|
||||
# Human readable label for the search strategy that put a package
|
||||
# into the search results (see PackagesController#search_packages)
|
||||
def search_source_label(source)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
= pkg.name
|
||||
.text
|
||||
= pkg.description
|
||||
- if @search_sources[pkg.id]
|
||||
- if search_sources_visible? && @search_sources[pkg.id]
|
||||
.text.search-source
|
||||
span.label.secondary = search_source_label(@search_sources[pkg.id])
|
||||
- elsif @view_style==:list
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
a href=package_path(name: pkg.name)
|
||||
=pkg.name
|
||||
p =pkg.description
|
||||
- if @search_sources[pkg.id]
|
||||
- if search_sources_visible? && @search_sources[pkg.id]
|
||||
p
|
||||
span.label.secondary = search_source_label(@search_sources[pkg.id])
|
||||
.listview.longdescription
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue