sort_only_once.patch

ciaran jessup, 2011-05-05 17:37

Download (1.48 KB)

View differences:

app/views/queries/_filters.rhtml
72 72
<tr>
73 73
<td>
74 74
<table>
75
<% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
75
<% sorted_available_filters= query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]} %>
76
<% sorted_available_filters.each do |filter| %>
76 77
    <% field = filter[0]
77 78
       options = filter[1] %>
78 79
    <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter">
......
107 108
</td>
108 109
<td class="add-filter">
109 110
<%= label_tag('add_filter_select', l(:label_filter_add)) %>:
110
<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [ field[1][:name] || l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact),
111
<%= select_tag 'add_filter_select', options_for_select([["",""]] + sorted_available_filters.collect{|field| [ field[1][:name] || l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact),
111 112
																		:onchange => "add_filter();",
112 113
																		:class => "select-small",
113 114
																		:name => nil %>