mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +01:00
27 lines
718 B
Ruby
27 lines
718 B
Ruby
# frozen_string_literal: true
|
|
|
|
module SearchHelper
|
|
def facet_list(facets)
|
|
return unless facets.present?
|
|
|
|
content_tag(:ul) do
|
|
facets.each do |facet|
|
|
concat content_tag(:li,
|
|
"#{facet.term} (#{facet.count})",
|
|
class: 'facet')
|
|
end
|
|
end
|
|
end
|
|
|
|
def filter_select(builder, name, desc, facets, selected)
|
|
capture do
|
|
concat(builder.label(name, desc))
|
|
concat(
|
|
builder.select(name,
|
|
options_from_collection_for_select(facets, :term, :term_with_count, selected),
|
|
{ include_blank: true },
|
|
{ onchange: 'this.form.submit();' })
|
|
)
|
|
end
|
|
end
|
|
end
|