issue过滤
This commit is contained in:
parent
11d83a863a
commit
3b70ab964d
|
@ -95,6 +95,7 @@ class IssuesController < ApplicationController
|
||||||
format.api {
|
format.api {
|
||||||
Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
|
Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
|
||||||
}
|
}
|
||||||
|
# format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json}
|
||||||
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
|
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
|
||||||
format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') }
|
format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') }
|
||||||
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') }
|
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') }
|
||||||
|
|
|
@ -255,8 +255,19 @@ module QueriesHelper
|
||||||
# Give it a name, required to be valid
|
# Give it a name, required to be valid
|
||||||
@query = IssueQuery.new(:name => "_")
|
@query = IssueQuery.new(:name => "_")
|
||||||
@query.project = @project
|
@query.project = @project
|
||||||
|
params[:f] = %w(subject status_id priority_id author_id assigned_to_id) unless params[:status_id].nil?
|
||||||
|
params[:op] = {'subject' => "~" ,
|
||||||
|
'status_id' => ( params[:status_id] == '0' ? "!":"=" ),
|
||||||
|
'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ),
|
||||||
|
'author_id' => ( params[:author_id] == '0' ? "!":"=" ),
|
||||||
|
'assigned_to_id' => ( params[:assigned_to_id] == '0' ? "!":"=" )} unless params[:status_id].nil?
|
||||||
|
params[:v] = {'subject' => [params[:subject]],
|
||||||
|
'status_id' => [params[:status_id]],
|
||||||
|
'priority_id' => [params[:priority_id]],
|
||||||
|
'author_id' => [params[:author_id]],
|
||||||
|
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
|
||||||
@query.build_from_params(params)
|
@query.build_from_params(params)
|
||||||
session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
|
#session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
|
||||||
else
|
else
|
||||||
# retrieve from session
|
# retrieve from session
|
||||||
@query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]
|
@query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]
|
||||||
|
|
|
@ -27,4 +27,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<ul class="wlist">
|
||||||
|
<%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||||
|
</ul>
|
|
@ -1,15 +1,71 @@
|
||||||
|
<script>
|
||||||
|
function remote_function() {
|
||||||
|
$.ajax({
|
||||||
|
url:'<%= project_issues_path(@project)%>',
|
||||||
|
data:{
|
||||||
|
subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||||
|
status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||||
|
assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||||
|
priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||||
|
author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
},
|
||||||
|
error: function(data){
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
<div class="project_r_h">
|
<div class="project_r_h">
|
||||||
<h2 class="project_h2"><%= l(:label_issue_tracking) %></h2>
|
<h2 class="project_h2"><%= l(:label_issue_tracking) %></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="problem_top">
|
<div class="problem_top">
|
||||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||||
<span>
|
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
|
||||||
<%= link_to l(:label_query), '#',
|
<%= hidden_field_tag 'set_filter', '1' %>
|
||||||
:onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %>
|
<div class="problem_search" >
|
||||||
</span>
|
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="">
|
||||||
|
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
|
||||||
|
</div><!--problem_search end-->
|
||||||
|
|
||||||
|
<div id="filter_form" class="fr" >
|
||||||
|
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给",0]),
|
||||||
|
{ :include_blank => false,:selected=>0
|
||||||
|
},
|
||||||
|
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"v[assigned_to_id]",:class=>"w90"}
|
||||||
|
)
|
||||||
|
%>
|
||||||
|
<%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
|
||||||
|
{ :include_blank => false,:selected=>0
|
||||||
|
},
|
||||||
|
{:onchange=>"remote_function();",:id=>"priority_id",:name=>"v[priority_id]",:class=>"w90"}
|
||||||
|
)
|
||||||
|
%>
|
||||||
|
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
|
||||||
|
{ :include_blank => false,:selected=>0
|
||||||
|
},
|
||||||
|
{:onchange=>"remote_function();",:id=>"status_id",:name=>"v[status_id]",:class=>"w90"}
|
||||||
|
)
|
||||||
|
%>
|
||||||
|
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]),
|
||||||
|
{ :include_blank => false,:selected=>0
|
||||||
|
},
|
||||||
|
{:onchange=>"remote_function();",:id=>"author_id",:name=>"v[author_id]",:class=>"w90"}
|
||||||
|
)
|
||||||
|
%>
|
||||||
|
</div><!--filter_form end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end %>
|
||||||
|
<p class="problem_p fl" ><%= l(:label_issues_sum) %>:
|
||||||
|
<a href="javascript:void(0)" class="c_red"><%= @project.issues.count %></a> <%= l(:lable_issues_undo) %>
|
||||||
|
<a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').count %> </a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="cl"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="problem_p fr"><%= l(:label_issues_sum) %>:<span><%= @project.issues.count %></span> <%= l(:lable_issues_undo) %>:<span><%= @project.issues.where('status_id in (1,2,4,6)').count %></span></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<% if !@query.new_record? && @query.editable_by?(User.current) %>
|
<% if !@query.new_record? && @query.editable_by?(User.current) %>
|
||||||
|
@ -20,49 +76,6 @@
|
||||||
|
|
||||||
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
|
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
|
||||||
<div style="clear:right; ">
|
<div style="clear:right; ">
|
||||||
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %>
|
|
||||||
<%= hidden_field_tag 'set_filter', '1' %>
|
|
||||||
<div id="custom_query" class="custom_query" style="display: <%= !params[:utf8].blank? ? 'block' : 'none' %>;">
|
|
||||||
<span>---<%= l :label_query_new %>---</span>
|
|
||||||
<div id="query_form_content" class="hide-when-print">
|
|
||||||
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
|
|
||||||
<legend onclick="toggleFieldset(this);">
|
|
||||||
<%= l(:label_issue_query_condition) %>
|
|
||||||
</legend>
|
|
||||||
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
|
|
||||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<!-- 选项,暂不需要
|
|
||||||
<fieldset class="collapsible collapsed">
|
|
||||||
<legend onclick="toggleFieldset(this);">
|
|
||||||
<%#= l(:label_options) %>
|
|
||||||
</legend>
|
|
||||||
<div style="display: none;">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td><%#= l(:field_column_names) %></td>
|
|
||||||
<td><%#= render_query_columns_selection(@query) %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for='group_by'><%#= l(:field_group_by) %></label></td>
|
|
||||||
<td><%#= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><%#= l(:button_show) %></td>
|
|
||||||
<td><%#= available_block_columns_tags(@query) %></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
-->
|
|
||||||
<div class="buttons hide-when-print">
|
|
||||||
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
|
|
||||||
<%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= error_messages_for 'query' %>
|
<%= error_messages_for 'query' %>
|
||||||
|
@ -73,10 +86,10 @@
|
||||||
<%= l(:label_no_data) %>
|
<%= l(:label_no_data) %>
|
||||||
</p>
|
</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
<div id="issue_list">
|
||||||
<ul class="wlist">
|
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %>
|
||||||
<%= pagination_links_full @issue_pages, @issue_count, :per_page_links => false, :remote => false, :flag => true %>
|
</div>
|
||||||
</ul>
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");
|
Loading…
Reference in New Issue