socialforge/app/views/users/user_issues.html.erb

291 lines
14 KiB
Plaintext

<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<script xmlns="http://www.w3.org/1999/html">
function add_style(){
// $("#proeject_id").val("来源");
if($("select[id='tracker_id']").val() != 0){
$("#tracker_id").addClass('issues_filter_active');
}
if($("select[id='author_id']").val() != 0){
$("#author_id").addClass('issues_filter_active');
}
if($("select[id='assigned_to_id']").val() !=0){
$("#assigned_to_id").addClass('issues_filter_active');
}
if($("select[id='priority_id']").val() !=0){
$("#priority_id").addClass('issues_filter_active');
}
if($("select[id='fixed_version_id']").val() !=0){
$("#fixed_version_id").addClass('issues_filter_active');
}
if($("select[id='status_id']").val() != 0 ){
$("#status_id").addClass('issues_filter_active');
}
if($("select[id='done_ratio']").val() != -1){
$("#done_ratio").addClass('issues_filter_active');
}
if($("select[id='test']").val() != 0 ){
$("#test").addClass('issues_filter_active');
}
if($("select[id='tracker_id']").val() == 0){
$("#tracker_id").removeClass('issues_filter_active');
}
if($("select[id='author_id']").val() == 0){
$("#author_id").removeClass('issues_filter_active');
}
if($("select[id='assigned_to_id']").val() ==0){
$("#assigned_to_id").removeClass('issues_filter_active');
}
if($("select[id='priority_id']").val() ==0){
$("#priority_id").removeClass('issues_filter_active');
}
if($("select[id='fixed_version_id']").val() ==0){
$("#fixed_version_id").removeClass('issues_filter_active');
}
if($("select[id='status_id']").val() == 0 ){
$("#status_id").removeClass('issues_filter_active');
}
if($("select[id='done_ratio']").val() == -1){
$("#done_ratio").removeClass('issues_filter_active');
}
if($("select[id='test']").val() == 0 ){
$("#test").removeClass('issues_filter_active');
}
};
//issues列表
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('issues_list_nav_'+i).className='issues_nav_nomal';
g('issues_list_content_'+i).className='undis';
}
g('issues_list_content_'+n).className='dis';
g('issues_list_nav_'+n).className='issues_nav_hover';
}
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
$("input[nhname='date_show']").change(function(){
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
remote_function();
});
});
function remote_function() {
$("#issue_query_form").submit();
}
function remote_function_export(project_id) {
var tracker_id = $("#tracker_id").attr("value");
var subject = $("#v_subject").attr("value");
var assigned_to_id = $("#assigned_to_id").attr("value");
var fixed_version_id = $("#fixed_version_id").attr("value");
var status_id = $("#status_id").attr("value");
var done_ratio = $("#done_ratio").attr("value");
var test = $("#test").attr("value");
var author_id = $("#author_id").attr("value");
var priority_id = $("#priority_id").attr("value");
var issue_create_date_start = $("#issue_date_start_issue_export").attr("value");
var issue_create_date_end = $("#issue_date_end_issue_export").attr("value");
$("#sendexcel").attr("href","/projects/"+project_id+"/issues.xls?export=true&set_filter=1&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end+"&priority_id="+priority_id);
///projects/1811/issues.xls?export=true&set_filter=1
}
function EnterPress(e){
var e = e || window.event;
if(e.keyCode == 13){
remote_function();
}
}
// 点击的时候让过滤条件选中assign_to
function switch_assign_to(assign) {
var assign = "option[value =" + assign + "]";
$("#issues_type_2").click(function(){
});
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
$("select[id='author_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
$("select[id='done_ratio']").val('');
$("select[id='test']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").removeClass('issues_filter_active');
$("#assigned_to_id").addClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
// 点击的时候让过滤条件选中user_id
function createByMe(user_id) {
var user = "option[value =" + user_id + "]";
$("#createByMe").click(function(){
});
$("select[id='author_id']").find(user).attr("selected", "selected");
$("select[id='assigned_to_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
$("select[id='done_ratio']").val('');
$("select[id='test']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").addClass('issues_filter_active');
$("#assigned_to_id").removeClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
// 清楚表单所有选项
function all_reset_form() {
$("#issue_query_form")[0].reset();
$("select[id='author_id']").val('');
$("select[id='assigned_to_id']").val('');
$("input[nhname='date_val']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").removeClass('issues_filter_active');
$("#assigned_to_id").removeClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
</script>
<!--缺陷列表开始-->
<div id="myissues_con" class="myissues_con mb10">
<div class="myissues_head mb5">
<h2 class="ml15">我的Issue</h2>
</div>
<div class="clear mb5">
<div class="issues_statistics fl">
<ul>
<li>所有<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issues_filter.count %></a></li>
<li>开启<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_open_count %></a></li>
<li>关闭<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
</div>
<%= form_tag( user_issues_user_path(@user), :remote=>'xls', :method => "post", :id=>"issue_query_form", :class => 'query_form') do %>
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="输入Issue名称进行搜索" type="text" id="v_subject" name="subject" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0);" class="hw_btn_search" onclick="remote_function();" ></a>
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<!-- <div class="issues_filter_data fr">
<input type="text" placeholder="开始日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl" style="border-right:none;"></a>
<input type="text" placeholder="结束日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl"></a>
</div>-->
</div>
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" id="issues_type_1" onclick="all_reset_form();" >搜索结果</a>
<span id="issue_filter_all"><%= render :partial => "users/my_issue_filter_all" %></span>
</li>
<li id="issues_list_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" id="issues_type_2" onclick="switch_assign_to(<%= User.current.id %>)">指派给我
<span id="issue_assigned_count"><%= render :partial => "users/my_issue_assigned_filter" %></span>
</a>
</li>
<li id="issues_list_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" id="issues_type_3" onclick="createByMe(<%= User.current.id %>)">我的发布<span class="issues_nav_tag ml5">
<%= @issues_author_count %>
</span></a>
</li>
<div class="cl"></div>
</ul>
<div class="issues_filter">
<div class="issues_form_filter mt5 mr5">
<!-- <select placeholder=" 来源" class="fl mr10" >
<option value="0" selected="selected">来源</option>
<option value="8166">123</option>
<option value="8166">123s</option>
</select>-->
<%= select( :project, :project_id, options_for_issue_project_list(@issues_filter),
{ :include_blank => false,:selected => @project_id ? @project_id : 0 },
{ :onchange => "remote_function();add_style();",:id => "proeject_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
)%>
<select placeholder=" 发布人" class="fl my_issues_filter" disabled="disabled" style="padding:0px;width: 50px;margin-right: 15px;">
<option value="0" selected="selected">发布人</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["发布人",0]),
{ :include_blank => false,:selected => @author_id ? @author_id : 0},
{:onchange => "remote_function();add_style();",:id => "author_id", :name => "author_id", :class => "fl", :style => "visibility:hidden;width: 0px;margin:0px;padding:0px;"}
)
%>
<select placeholder=" 类型" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px;width:35px; margin-right:10px;">
<option value="0" selected="selected">类型</option>
</select>
<select placeholder=" 指派给" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right: 15px;">
<option value="0" selected="selected">指派给</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["指派给",0]),
{ :include_blank => false, :selected => @assigned_to ? @assigned_to : 0},
{:onchange=>"remote_function();add_style();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl", :style => "visibility:hidden; width:0px;margin:0px;padding:0px;"} )
%>
<select placeholder=" 优先度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">优先度</option>
</select>
<select placeholder=" 里程碑" class="fl my_issues_filter" disabled="disabled" style="padding:0px;margin-left: 20px; margin-right: 10px">
<option value="0" selected="selected">里程碑</option>
</select>
<select placeholder=" 状态" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right:10px;width:35px;">
<option value="0" selected="selected">状态</option>
</select>
<select placeholder=" 完成度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">完成度</option>
</select>
<select placeholder=" 排序" class="fl my_issues_filter" disabled="disabled" style="width:50px;visibility:hidden;margin-left: 0px;margin-right: 0px;">
<option value="0" selected="selected">排序</option>
</select>
</div>
<div class="cl"></div>
</div>
<% end %>
<% if @issues.empty? %>
<p class="nodata mt10"><%= l(:label_no_data) %></p>
<% else %>
<div id="issue_list">
<%= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
</div>
<% end %>
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<!--issues_con_list end-->
<!--缺陷列表结束-->
<!--缺陷列表结束-->