cirandas.net

ref: master

plugins/solr/views/solr_plugin/search/_facet_results.html.erb


<%
  less_options_limit = 8 if less_options_limit.nil?
  if @all_facets_enabled
    btn_icon = "less"
    btn_label = "See less options"
  else
    btn_icon = "more"
    btn_label = "See more options"
  end
  results = @asset_class.map_facet_results facet, params[:facet], @facets, @all_facets, limit: less_options_limit
  facet_count = results.total_entries
%>

<%= @asset_class.facet_label facet %>
<% if facet_count > 0 %>
<% results.each do |id, label, count| %> <%= facet_link_html facet, params.merge(action: @asset), id, label, count %>
<% end %> <% if facet_count > less_options_limit %>
<%= button_to_function btn_icon, _(btn_label), "solr.facets.more_or_less(this, '#{url_for(params.merge(action: 'facets_browse', facet_id: facet[:id], asset_key: @asset, escape: false))}')", data: {'all-facets' => !!@all_facets_enabled} %>
<% end %>
<% else %> <%= _("No filter available") %> <% end %>