Created
April 9, 2013 20:54
-
-
Save rterbush/5349302 to your computer and use it in GitHub Desktop.
Filter template for use with jbrien/spree_sunspot_search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="filter" data-field="<%= filter.search_param %>"> | |
<h4 class="filter-title"><%= t :shop_by_taxonomy, :taxonomy => filter.display_name %></h4> | |
<ul class="filter_choices"> | |
<select name="<%= "s[#{filter.search_param}][]" %>" class="sidebar" size="10" multiple="true"> | |
<% options = [] %> | |
<% filter.html_values.each_with_index.each do |hv, index| %> | |
<% options << hv[:value] %> | |
<% end %> | |
<% sortopts = options.sort %> | |
<% sortopts.each do |hv| %> | |
<% selected = params[:s][filter.search_param].include? hv.to_s if params[:s] and params[:s][filter.search_param].present? %> | |
<% if selected %> | |
<option value="<%= hv %>" selected><%= hv %></option> | |
<% else %> | |
<option value="<%= hv %>"><%= hv %></option> | |
<% end %> | |
<% end %> | |
</select> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment