"queries" branch merged

git-svn-id: http://redmine.rubyforge.org/svn/trunk@95 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2006-12-16 13:37:32 +00:00
1 parent 236c735d08
commit 2b0142580f
27 files changed
+580 -177

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
<h2><%= l(:label_query_new) %></h2>
<%= start_form_tag :action => 'add_query', :id => @project %>
<%= render :partial => 'queries/form', :locals => {:query => @query} %>
<%= submit_tag l(:button_create) %>
<%= end_form_tag %>
+44 -32
View File
@@ -1,34 +1,40 @@
<div class="contextual">
<%= l(:label_export_to) %>
<%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'pic picCsv' %>,
<%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'pic picPdf' %>
</div>
<h2><%=l(:label_issue_plural)%></h2>
<%= start_form_tag :action => 'list_issues' %>
<table cellpadding=2>
<tr>
<td valign="bottom"><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
<td valign="bottom">
<%= hidden_field_tag 'set_filter', 1 %>
<%= submit_tag l(:button_apply), :class => 'button-small' %>
</td>
<td valign="bottom">
<%= link_to l(:button_clear), :action => 'list_issues', :id => @project, :set_filter => 1 %>
</td>
</tr>
</table>
<%= end_form_tag %>
&nbsp;
<% if @query.new_record? %>
<h2><%=l(:label_issue_plural)%></h2>
<%= start_form_tag({:action => 'list_issues'}, :id => 'query_form') %>
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
<%= end_form_tag %>
<div class="contextual">
<%= link_to_remote l(:button_apply),
{ :url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 },
:update => "content",
:with => "Form.serialize('query_form')"
}, :class => 'pic picCheck' %>
<%= link_to l(:button_clear), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1}, :class => 'pic picDelete' %>
<% if authorize_for('projects', 'add_query') %>
<%= link_to_remote l(:button_save),
{ :url => { :controller => 'projects', :action => "add_query", :id => @project },
:method => 'get',
:update => "content",
:with => "Form.serialize('query_form')"
}, :class => 'pic picEdit' %>
<% end %>
</div>
<br />
<% else %>
<% if authorize_for('projects', 'add_query') %>
<div class="contextual">
<%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'pic picEdit' %>
<%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %>
</div>
<% end %>
<h2><%= @query.name %></h2>
<% end %>
<%= error_messages_for 'query' %>
<% if @query.valid? %>
&nbsp;
<table class="listTableContent">
<tr>
<td colspan="6" align="left"><small><%= check_all_links 'issues_form' %></small></td>
@@ -67,9 +73,15 @@
</tr>
<% end %>
</table>
<div class="contextual">
<%= l(:label_export_to) %>
<%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'pic picCsv' %>,
<%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'pic picPdf' %>
</div>
<p>
<%= pagination_links_full @issue_pages %>
[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
</p>
<%= submit_tag l(:button_move) %>
<%= end_form_tag %>
<%= end_form_tag %>
<% end %>
+100
View File
@@ -0,0 +1,100 @@
<script>
function add_filter() {
select = $('add_filter_select');
field = select.value
Element.show('tr_' + field);
check_box = $('cb_' + field);
check_box.checked = true;
toggle_filter(field);
select.selectedIndex = 0;
for (i=0; i<select.options.length; i++) {
if (select.options[i].value == field) {
select.options[i].disabled = true;
}
}
}
function toggle_filter(field) {
check_box = $('cb_' + field);
if (check_box.checked) {
Element.show("operators[" + field + "]");
toggle_operator(field);
} else {
Element.hide("operators[" + field + "]");
Element.hide("values_div[" + field + "]");
}
}
function toggle_operator(field) {
operator = $("operators[" + field + "]");
switch (operator.value) {
case "!*":
case "*":
case "t":
case "o":
case "c":
Element.hide("values_div[" + field + "]");
break;
default:
Element.show("values_div[" + field + "]");
break;
}
}
function toggle_multi_select(field) {
select = $('values[' + field + '][]');
if (select.multiple == true) {
select.multiple = false;
} else {
select.multiple = true;
}
}
</script>
<fieldset style="margin:0;"><legend><%= l(:label_filter_plural) %></legend>
<table width="100%" cellpadding=0 cellspacing=0>
<tr>
<td>
<table>
<% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
<% field = filter[0]
options = filter[1] %>
<tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>">
<td valign="top" width="200">
<%= check_box_tag 'fields[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>
<label for="cb_<%= field %>"><%= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>
</td>
<td valign="top" width="150">
<%= select_tag "operators[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>
</td>
<td valign="top">
<div id="values_div[<%= field %>]">
<% case options[:type]
when :list, :list_optional, :list_status %>
<select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %>" name="values[<%= field %>][]" id="values[<%= field %>][]" class="select-small" style="vertical-align: top;">
<%= options_for_select options[:values], query.values_for(field) %>
</select>
<%= link_to_function image_tag('expand'), "toggle_multi_select('#{field}');" %>
<% when :date, :date_past %>
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %>
<% when :text %>
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 30, :class => "select-small" %>
<% end %>
</div>
</td>
</tr>
<script>toggle_filter('<%= field %>');</script>
<% end %>
</table>
</td>
<td align="right" valign="top">
<%= l(:label_filter_add) %>:
<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [l(("field_"+field[0].to_s.gsub(/\_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact), :onchange => "add_filter();", :class => "select-small" %>
</td>
</tr>
</table>
</fieldset>
+12
View File
@@ -0,0 +1,12 @@
<%= error_messages_for 'query' %>
<!--[form:query]-->
<div class="box">
<div class="tabular">
<p><label for="query_name"><%=l(:field_name)%></label>
<%= text_field 'query', 'name', :size => 80 %></p>
</div>
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
</div>
<!--[eoform:query]-->
+6
View File
@@ -0,0 +1,6 @@
<h2><%= l(:label_query) %></h2>
<%= start_form_tag :action => 'edit', :id => @query %>
<%= render :partial => 'form', :locals => {:query => @query} %>
<%= submit_tag l(:button_save) %>
<%= end_form_tag %>
+3 -3
View File
@@ -29,17 +29,17 @@
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "O" %></td>
"status_id" => "o" %></td>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "C" %></td>
"status_id" => "c" %></td>
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "A" %></td>
"status_id" => "*" %></td>
<% end %>
</tr>
</table>
+3 -3
View File
@@ -18,17 +18,17 @@
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "O" %></td>
"status_id" => "o" %></td>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "C" %></td>
"status_id" => "c" %></td>
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "A" %></td>
"status_id" => "*" %></td>
<% end %>
</tr>
</table>
+16 -4
View File
@@ -1,18 +1,30 @@
<h2><%=l(:label_report_plural)%></h2>
<h3><%= l(:label_query_plural) %></h3>
<div class="contextual">
<%= link_to_if_authorized l(:label_query_new), {:controller => 'projects', :action => 'add_query', :id => @project}, :class => 'pic picAdd' %>
</div>
<% if @queries.empty? %><p><i><%=l(:label_no_data)%></i></p><% end %>
<ul>
<% @queries.each do |query| %>
<li><%= link_to query.name, :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => query %></li>
<% end %>
</ul>
<div class="splitcontentleft">
<h3><%=l(:field_tracker)%>&nbsp;&nbsp;<%= link_to image_tag('details'), :detail => 'author' %></h3>
<h3><%=l(:field_tracker)%>&nbsp;&nbsp;<%= link_to image_tag('details'), :detail => 'tracker' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
<br />
<h3><%=l(:field_priority)%>&nbsp;&nbsp;<%= link_to image_tag('details'), :detail => 'priority' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
<br />
<h3><%=l(:field_author)%>&nbsp;&nbsp;<%= link_to image_tag('details'), :detail => 'author' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
<br />
</div>
<div class="splitcontentright">
<h3><%=l(:field_priority)%>&nbsp;&nbsp;<%= link_to image_tag('details'), :detail => 'priority' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
<br />
<h3><%=l(:field_category)%>&nbsp;&nbsp;<%= link_to image_tag('details'), :detail => 'category' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
<br />