mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
refactor facets_list helper
This commit is contained in:
parent
1cf5485356
commit
4aa0b2424b
2 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ class SearchController < ApplicationController
|
||||||
|
|
||||||
@response = Paper.search(params[:q], options)
|
@response = Paper.search(params[:q], options)
|
||||||
@papers = @response.page(params[:page]).results
|
@papers = @response.page(params[:page]).results
|
||||||
@paper_type_facets = @response.response['aggregations']['paper_types']['buckets'].map {|h| [ h['key'], h['doc_count']] }
|
@paper_type_facets = @response.response['aggregations']['paper_types']['buckets']
|
||||||
@originator_facets = @response.response['aggregations']['originators']['buckets'].map {|h| [ h['key'], h['doc_count']] }
|
@originator_facets = @response.response['aggregations']['originators']['buckets']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,9 @@ module SearchHelper
|
||||||
def facet_list(facets)
|
def facet_list(facets)
|
||||||
return unless facets.present?
|
return unless facets.present?
|
||||||
content_tag(:ul) do
|
content_tag(:ul) do
|
||||||
facets.each do |term, count|
|
facets.each do |facet|
|
||||||
concat content_tag(:li,
|
concat content_tag(:li,
|
||||||
"#{term} (#{count})",
|
"#{facet['key']} (#{facet['doc_count']})",
|
||||||
class: "facet"
|
class: "facet"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue