@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
@issue_pages = Paginator.new self, @issue_count, 25, params['page']
@issues = Issue.find :all, :order => sort_clause,
- :include => [ :assigned_to, :status, :tracker, :project, :priority ],
+ :include => [ :assigned_to, :status, :tracker, :project, :priority, :category ],
:conditions => @query.statement,
:limit => @issue_pages.items_per_page,
:offset => @issue_pages.current.offset
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
@issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
@issues = Issue.find :all, :order => sort_clause,
- :include => [ :assigned_to, :status, :tracker, :project, :priority ],
+ :include => [ :assigned_to, :status, :tracker, :project, :priority, :category ],
:conditions => @query.statement,
:limit => @issue_pages.items_per_page,
:offset => @issue_pages.current.offset
if has_default_columns?
available_columns.select {|c| c.default? }
else
- available_columns.select {|c| column_names.include?(c.name) }
+ # preserve the column_names order
+ column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact
end
end
<% content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %>
<legend><%= l(:field_column_names) %></legend>
-<% query.available_columns.each do |column| %>
-<label><%= check_box_tag 'query[column_names][]', column.name, query.has_column?(column) %> <%= l("field_#{column.name}") %></label><br />
-<% end %>
+
<%= hidden_field_tag 'query[column_names][]', '' %>
+<table margin=0>
+ <tr>
+ <td><%= select_tag 'available_columns',
+ options_for_select((query.available_columns - query.columns).collect {|column| [l("field_#{column.name}"), column.name]}),
+ :multiple => true, :size => 10, :style => "width:150px" %>
+ </td>
+ <td align="center" valign="middle">
+ <input type="button" value="-->"
+ onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br />
+ <input type="button" value="<--"
+ onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" />
+ </td>
+ <td><%= select_tag 'query[column_names][]',
+ options_for_select(@query.columns.collect {|column| [l("field_#{column.name}"), column.name]}),
+ :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px" %>
+ </td>
+ </tr>
+</table>
+<% end %>
+
+<% content_for :header_tags do %>
+<%= javascript_include_tag 'select_list_move' %>
<% end %>
<p><label for="query_default_columns"><%=l(:label_default_columns)%></label>
<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns',
- :onchange => 'if (this.checked) {Element.hide("columns")} else {Element.show("columns")}' %></p>
+ :onclick => 'if (this.checked) {Element.hide("columns")} else {Element.show("columns")}' %></p>
</div>
-<%= render :partial => 'queries/columns', :locals => {:query => query}%>
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
+<%= render :partial => 'queries/columns', :locals => {:query => query}%>
</div>
<h2><%= l(:label_query) %></h2>
-<% form_tag({:action => 'edit', :id => @query}) do %>
+<% form_tag({:action => 'edit', :id => @query}, :onsubmit => 'selectAllOptions("selected_columns");') do %>
<%= render :partial => 'form', :locals => {:query => @query} %>
<%= submit_tag l(:button_save) %>
<% end %>
<h2><%= l(:label_query_new) %></h2>\r
\r
-<% form_tag({:action => 'new', :project_id => @query.project}) do %>\r
+<% form_tag({:action => 'new', :project_id => @query.project}, :onsubmit => 'selectAllOptions("selected_columns");') do %>\r
<%= render :partial => 'form', :locals => {:query => @query} %>\r
<%= submit_tag l(:button_save) %>\r
<% end %>\r
--- /dev/null
+var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);\r
+\r
+function addOption(theSel, theText, theValue)\r
+{\r
+ var newOpt = new Option(theText, theValue);\r
+ var selLength = theSel.length;\r
+ theSel.options[selLength] = newOpt;\r
+}\r
+\r
+function deleteOption(theSel, theIndex)\r
+{ \r
+ var selLength = theSel.length;\r
+ if(selLength>0)\r
+ {\r
+ theSel.options[theIndex] = null;\r
+ }\r
+}\r
+\r
+function moveOptions(theSelFrom, theSelTo)\r
+{\r
+ \r
+ var selLength = theSelFrom.length;\r
+ var selectedText = new Array();\r
+ var selectedValues = new Array();\r
+ var selectedCount = 0;\r
+ \r
+ var i;\r
+ \r
+ for(i=selLength-1; i>=0; i--)\r
+ {\r
+ if(theSelFrom.options[i].selected)\r
+ {\r
+ selectedText[selectedCount] = theSelFrom.options[i].text;\r
+ selectedValues[selectedCount] = theSelFrom.options[i].value;\r
+ deleteOption(theSelFrom, i);\r
+ selectedCount++;\r
+ }\r
+ }\r
+ \r
+ for(i=selectedCount-1; i>=0; i--)\r
+ {\r
+ addOption(theSelTo, selectedText[i], selectedValues[i]);\r
+ }\r
+ \r
+ if(NS4) history.go(0);\r
+}\r
+\r
+function selectAllOptions(id)\r
+{\r
+ var select = $(id);\r
+ for (var i=0; i<select.options.length; i++) {\r
+ select.options[i].selected = true;\r
+ }\r
+}\r
+\r