issue功能优化

This commit is contained in:
daiao 2016-09-26 16:22:14 +08:00
parent 617565bf1f
commit 0ec1ecc2bf
4 changed files with 37 additions and 11 deletions

View File

@ -84,10 +84,24 @@ class IssuesController < ApplicationController
@done_ratio = params[:done_ratio]
@fixed_version_id = params[:fixed_version_id]
@issue_count = @query.issue_count
@test = params[:test]
# @issue_pages = Paginator.new @issue_count, @limit, params['page']
# params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
# @offset ||= @issue_pages.offset
@issues_filter = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => 'issues.updated_on desc')
@project_sort = 'issues.updated_on desc'
if params[:test] != "0"
case @test
when "1"
@project_sort = 'issues.created_on desc'
when "2"
@project_sort = 'issues.created_on asc'
when "3"
@project_sort = 'issues.updated_on desc'
when "4"
@project_sort = 'issues.updated_on asc'
end
end
@issues_filter = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => @project_sort)
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1

View File

@ -255,17 +255,17 @@ module QueriesHelper
# Give it a name, required to be valid
@query = IssueQuery.new(:name => "_")
@query.project = @project
params[:f] = %w(subject tracker_id status_id done_ratio assigned_to_id fixed_version_id created_on) unless params[:status_id].nil?
params[:f] = %w(subject tracker_id status_id done_ratio author_id assigned_to_id fixed_version_id created_on) unless params[:status_id].nil?
params[:op] = {'subject' => "~" ,
'status_id' => ( params[:status_id] == '0' ? "!":"=" ),
'author_id' =>(params[:author_id] == '0' ? "!":"=" ),
'done_ratio' => ( params[:done_ratio] == '0' ? "!":"=" ),
'tracker_id' => ( params[:tracker_id] == '0' ? "!":"=" ),
'fixed_version_id' => ( params[:fixed_version_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]],
'author_id' => [params[:author_id]],
'done_ratio' => [params[:done_ratio]],
'tracker_id' => [params[:tracker_id]],
'fixed_version_id' => [params[:fixed_version_id]],

View File

@ -11,9 +11,9 @@
//如果有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(){
@ -78,6 +78,8 @@
function all_reset_form() {
$("#issue_query_form")[0].reset();
$("select[id='author_id']").val('');
$("select[id='assigned_to_id']").val('');
remote_function();
}
</script>
@ -103,7 +105,7 @@
<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>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="nh_reset_form();">清除</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="HoverLi(1);all_reset_form();">清除</a>
<div class="calendar_div fr">
<input name="issue_create_date_end" nhname="date_val" type="hidden"/>
@ -121,7 +123,7 @@
<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);nh_reset_form();">
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
<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);">
@ -147,7 +149,7 @@
%>
<%= select(:issue, :fixed_version, 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"}) %>
{:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "fl"}) %>
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
{ :include_blank => false,:selected=>@status_id ? @status_id : 0
@ -170,10 +172,20 @@
{:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %>
<%= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]),
<%#= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]),
{:include_blank => false, :selected => @order ? @order : 0 },
{:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %>
<%= 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;"}
)
%>
<%#= 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
},

View File

@ -819,7 +819,7 @@ a:hover.issues_list_title{color:#3b94d6;}
.issues_list_titlebox span{ font-size: 12px;color: #888; font-weight: normal; }
.issues_ciricons_01{ width: 22px; height: 22px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 0 no-repeat;}
.issues_ciricons_02{ width: 22px; height: 22px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -30px no-repeat;}
.issues_icons_mes{width: 17px; height: 19px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -54px no-repeat; }
.issues_icons_mes{width: 17px; height: 19px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -56px no-repeat; }
.issues_list_name{ font-size: 12px;}
.issues_list_name:hover{ color: #3b94d6;}
.issues_list_small{ font-size: 12px; color: #666;}