opgroups and sorted lables for group_bys (again)

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1792 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
j.wollert 14 years ago
parent 76cdcba1ad
commit cf4b6699b7
  1. 18
      app/views/cost_reports/_group_by.rhtml

@ -4,13 +4,19 @@
query A CostQuery object
%>
<% grouped_gbs = CostQuery::GroupBy.all_grouped %>
<div id="group_by_area">
<%= l(:label_columns) %>:
<div id="group_columns" class="drag_target drag_container">
<select id="group_by_columns" name="groups[columns][]" class="select-small" onchange="add_group_by(this);">
<option value=""></option>
<% CostQuery::GroupBy.all.each do |group_by| %>
<option value="<%= group_by.underscore_name %>"><%= l(group_by.label)%></option>
<% grouped_gbs.each do |label , group_by_ary| %>
<optgroup label="<%= l(label) %>">
<% group_by_ary.select(&:display?).sort_by {|gb| l(gb.label)}.each do |group_by| %>
<option value="<%= group_by.underscore_name %>"><%= l(group_by.label)%></option>
<% end %>
</optgroup>
<% end %>
</select>
</div>
@ -18,8 +24,12 @@
<div id="group_rows" class="drag_target drag_container">
<select id="group_by_rows" name="groups[rows][]" class="select-small" onchange="add_group_by(this);">
<option value=""></option>
<% CostQuery::GroupBy.all.each do |group_by| %>
<option value="<%= group_by.underscore_name %>"><%= l(group_by.label)%></option>
<% grouped_gbs.each do |label , group_by_ary| %>
<optgroup label="<%= l(label) %>">
<% group_by_ary.select(&:display?).sort_by {|gb| l(gb.label)}.each do |group_by| %>
<option value="<%= group_by.underscore_name %>"><%= l(group_by.label)%></option>
<% end %>
</optgroup>
<% end %>
</select>
</div>

Loading…
Cancel
Save