stadtratmonitor/app/helpers/search_helper.rb

27 lines
644 B
Ruby
Raw Normal View History

2015-06-22 20:38:13 +02:00
module SearchHelper
def facet_list(facets)
return unless facets.present?
content_tag(:ul) do
2015-06-22 20:58:25 +02:00
facets.each do |facet|
2015-06-22 20:38:13 +02:00
concat content_tag(:li,
2015-06-22 21:11:51 +02:00
"#{facet.term} (#{facet.count})",
2015-06-22 20:38:13 +02:00
class: "facet"
)
end
end
end
def filter_select(name, desc, facets, selected)
capture do
concat(label name, desc)
concat(
select_tag name,
options_from_collection_for_select(facets, :term, :term_with_count, selected),
include_blank: true,
onchange: "this.form.submit();"
)
end
end
2015-06-22 20:38:13 +02:00
end