<% # a hash mapping Category => [array, of, conditions], sorted by category categorized_conditions = @conditions .group_by {|c| c.meta[:category].presence} .sort_by do |(category, _conditions)| if @refine_filter.has_category_ordering? @refine_filter.category_order.index(category) || Float::INFINITY else category.to_s.downcase end end .to_h recommended_conditions = @conditions .select { |c| c.meta[:recommended] } .sort_by {|recommended| recommended.to_s.downcase } # an array of uncategorized conditions uncategorized_conditions = categorized_conditions.delete(nil) %> <%= turbo_frame_tag @criterion do %>
<%= render "refine/inline/filters/popup", frame_id: dom_id(@criterion, :load), src: refine_inline_stored_filters_path(@criterion.to_params), frame_class: "refine--stored-filter-list-popup" do %> <%= link_to "#", class: "refine--stored-filters-link", data: {action: "click->refine--popup#show"} do %>
save
<%= t('.saved_filters') %> <% end %> <% end %>
<% if uncategorized_conditions&.any? %> <% uncategorized_conditions.each do |condition| %> <%= render partial: "condition_list_item", locals: {condition: condition } %> <% end %> <% end %> <% if recommended_conditions.any? %> <%= t('.recommended') %> <% recommended_conditions.each do |condition| %> <%= render partial: "condition_list_item", locals: {condition: condition } %> <% end %> <% end %> <% categorized_conditions.each do |(category, conditions)| %> <%= category %> <% conditions.each do |condition| %> <%= render partial: "condition_list_item", locals: {condition: condition, category: category } %> <% end %> <% end %>
<% end %>