socialforge/app/views/issues/index.html.erb

254 lines
15 KiB
Plaintext
Raw Normal View History

2015-12-16 11:50:30 +08:00
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<script>
2016-09-23 09:05:26 +08:00
//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';
2016-09-26 16:22:14 +08:00
2016-09-23 09:05:26 +08:00
}
2016-09-26 16:22:14 +08:00
2016-09-23 09:05:26 +08:00
g('issues_list_nav_'+n).className='issues_nav_hover';
}
$(function(){
2015-12-16 11:50:30 +08:00
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
2015-05-23 16:26:15 +08:00
$("input[nhname='date_show']").change(function(){
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
2015-05-23 16:26:15 +08:00
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
remote_function();
});
2015-12-16 11:50:30 +08:00
});
function remote_function() {
$("#issue_query_form").submit();
// $.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){
// }
// });
}
// function nh_reset_form() {
// $("#issue_query_form")[0].reset();
// $("input[nhname='date_val']").val('');//涛哥的火狐reset 清不掉这个值 我擦
// remote_function();
// }
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 + "]";
2016-09-23 14:51:44 +08:00
$("#issues_type_2").click(function(){
$("select[id='author_id']").val('');
});
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
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");
remote_function();
}
// 清楚表单所有选项
function all_reset_form() {
$("#issue_query_form")[0].reset();
2016-09-26 16:22:14 +08:00
$("select[id='author_id']").val('');
$("select[id='assigned_to_id']").val('');
$("input[nhname='date_val']").val('');
remote_function();
}
</script>
2016-09-23 17:47:53 +08:00
<div class="homepageRight mt0 ml10" >
<div class="issues_con fl">
<div class="clear mb5">
<a href="<%= new_project_issue_path(@project)%>" class="sy_btn_green fl mr10">新 增</a>
<div class="issues_statistics fl">
<ul>
<li>所有<a class="issues_greycirbg_btn "><%= @project.project_score.issue_num %></a></li>
<li>开启<a class="issues_greycirbg_btn "><%#= @issues_filter_assign_count %><%= @project.issues.where('status_id in (1,2,3,4,6)').visible.all.count %></a></li>
<li>关闭<a class="issues_greycirbg_btn "><%#= @issues_filter_author_count %><%= @project.issues.where(:status_id => 5 ).visible.all.count %></a></li>
2016-09-23 17:47:53 +08:00
</ul>
</div><!--issues_statistics end-->
<a href="<%=project_issues_path(:project_id => @project, :format => 'xls')%>" class="hw_btn_blue fr" alt="导出EXCEL">导出EXCEL</a>
</div>
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %>
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="请输入问题名称" 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>
2016-09-26 16:22:14 +08:00
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="HoverLi(1);all_reset_form();">清除</a>
2016-09-23 17:47:53 +08:00
2016-09-23 20:19:47 +08:00
<div class="calendar_div fr">
<input name="issue_create_date_end" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_end_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="结束日期">
<%= calendar_for('issue_create_date_end_show')%>
</div>
<div class="calendar_div fr">
<input name="issue_create_date_start" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_start_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="开始日期">
<%= calendar_for('issue_create_date_start_show')%>
</div>
2016-09-23 17:47:53 +08:00
<!--<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 class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
2016-09-26 16:22:14 +08:00
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
2016-09-23 17:47:53 +08:00
<a href="javascript:void(0);" onclick="all_reset_form();" id="issues_type_1" >所有<span class="issues_nav_tag ml5"><%= @project.project_score.issue_num %></span></a>
</li>
<li id="issues_list_nav_2" onclick="HoverLi(2);">
2016-09-26 21:02:12 +08:00
<a href="javascript:void(0);" onclick="switch_assign_to(<%= User.current.id %>)" id="issues_type_2" >指派给我
<span id="issue_assigned_count"><%= render :partial => "issues/issue_filter" %></span>
</a>
2016-09-23 17:47:53 +08:00
</li>
<li id="issues_list_nav_3" onclick="HoverLi(3);">
2016-09-26 21:02:12 +08:00
<a href="javascript:void(0);" onclick="createByMe(<%= User.current.id %>)" id="issues_type_3" >我的发布
<span id="issue_author_count"><%= render :partial => "issues/issue_filter_author" %></span>
</a>
2016-09-23 17:47:53 +08:00
</li>
<div class="cl"></div>
2016-09-26 21:02:12 +08:00
2016-09-23 17:47:53 +08:00
</ul>
2016-09-26 21:02:12 +08:00
2016-09-23 17:47:53 +08:00
<div class="issues_filter ">
<div class="issues_form_filter mt5 mr5">
2016-09-25 16:05:04 +08:00
<%= select(:issue, :tracker, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]),
{:include_blank => false, :selected => @tracker_id ? @tracker_id : 0},
{:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %>
2016-09-23 17:47:53 +08:00
<%= select( :issue, :user_id, principals_options_for_isuue_list(@project),
{ :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0
},
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"}
2016-09-23 17:47:53 +08:00
)
%>
2016-09-25 16:05:04 +08:00
<%= select(:issue, :fixed_version, options_for_version_isuue_list(@project),
{:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0},
2016-09-26 16:22:14 +08:00
{:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "fl"}) %>
2016-09-25 16:05:04 +08:00
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
{ :include_blank => false,:selected=>@status_id ? @status_id : 0
},
{:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"}
)
%>
<%#= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
2016-09-23 17:47:53 +08:00
{ :include_blank => false,:selected=>@priority_id ? @priority_id : 0
},
{:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"fl"}
2016-09-23 17:47:53 +08:00
)
%>
<%#= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["100%",10]].unshift(["完成度",0]),
{:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 },
{:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %>
2016-09-26 21:58:59 +08:00
<%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }).unshift(["完成度",-1]),
{:include_blank => false, :selected => @done_ratio ? @done_ratio : -1},
{:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %>
2016-09-23 19:36:43 +08:00
2016-09-26 16:22:14 +08:00
<%#= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]),
2016-09-25 16:05:04 +08:00
{:include_blank => false, :selected => @order ? @order : 0 },
{:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %>
2016-09-23 19:36:43 +08:00
2016-09-26 16:22:14 +08:00
<%= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]),
{:include_blank => false, :selected => @test ? @test : 0 },
{:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %>
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]),
{ :include_blank => false,:selected=>@author_id ? @author_id : 0},
{:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:style=>"display:none;"}
)
%>
2016-09-23 19:36:43 +08:00
<%#= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]),
2016-09-23 17:47:53 +08:00
{ :include_blank => false,:selected=>@author_id ? @author_id : 0
},
{:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"w90 mr18"}
)
%>
2016-09-23 19:36:43 +08:00
2016-09-23 17:47:53 +08:00
<%#= select(:issue, :tracker_id, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]),
{:include_blank => false, :selected => @tracker_id ? @tracker_id : 0},
{:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %>
<%#= select( :issue, :user_id, principals_options_for_isuue_list(@project),
{ :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0},
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"})
%>
<%#= select(:issue, :fixed_version_id, options_for_version_isuue_list(@project),
{:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0},
{:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "f1"}) %>
2016-09-23 19:36:43 +08:00
<%#= select( :issue, :status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
2016-09-23 17:47:53 +08:00
{ :include_blank => false,:selected=>@status_id ? @status_id : 0
},
{:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"}
) %>
2016-09-23 19:36:43 +08:00
<%#= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
{:include_blank => false, :selected => @done_ratio ? @done_ratio : 0},
{:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %>
2016-09-23 17:47:53 +08:00
<%#= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["10%",10]].unshift(["完成度",0]),
{:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 },
{:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %>
<%#= select(:issue, :test, [["最早创建",1],["最早更新",2]].unshift(["排序",0]),
{:include_blank => false, :selected => @order ? @order : 0 },
{:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %>
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
2015-12-16 11:50:30 +08:00
<% end %>
2016-09-23 17:47:53 +08:00
<% end %>
2016-09-23 19:36:43 +08:00
<% if @issues.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
<div id="issue_list">
<%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
</div>
<% end %>
<%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
</div><!--issues_con_list end-->
2016-09-23 17:47:53 +08:00
</div>
2016-09-26 21:58:59 +08:00
</div>