mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
helper for facet lists
This commit is contained in:
parent
cb877d510e
commit
7a7083c2ad
2 changed files with 20 additions and 11 deletions
13
app/helpers/search_helper.rb
Normal file
13
app/helpers/search_helper.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module SearchHelper
|
||||||
|
def facet_list(facets)
|
||||||
|
return unless facets.present?
|
||||||
|
content_tag(:ul) do
|
||||||
|
facets.each do |term, count|
|
||||||
|
concat content_tag(:li,
|
||||||
|
"#{term} (#{count})",
|
||||||
|
class: "facet"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,17 +1,13 @@
|
||||||
div
|
div
|
||||||
= render 'search/form'
|
= render 'search/form'
|
||||||
|
|
||||||
|
|
||||||
|
- if params[:q].present?
|
||||||
.row
|
.row
|
||||||
.small-4.columns
|
.small-4.columns
|
||||||
ul
|
= facet_list(@paper_type_facets)
|
||||||
- @paper_type_facets.each do |paper_type, count|
|
|
||||||
li.facet
|
|
||||||
= "#{paper_type} (#{count})"
|
|
||||||
.small-4.columns.end
|
.small-4.columns.end
|
||||||
ul
|
= facet_list(@originator_facets)
|
||||||
- @originator_facets.each do |originator, count|
|
|
||||||
li.facet
|
|
||||||
= "#{originator} (#{count})"
|
|
||||||
|
|
||||||
.clearfix
|
.clearfix
|
||||||
- if params[:q].present?
|
- if params[:q].present?
|
||||||
|
|
Loading…
Reference in a new issue