From 222ef3c6afb89b9c7c2f821f5163148632379d26 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 23 Sep 2016 19:36:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=87=E6=BB=A4=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/issues_helper.rb | 3 ++- app/helpers/queries_helper.rb | 8 ++++--- app/views/issues/index.html.erb | 39 +++++++++++++++++++++++---------- app/views/issues/index.js.erb | 2 +- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 7b1347d3f..0ab09802f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -127,9 +127,10 @@ module IssuesHelper end def options_for_version_isuue_list(project) - versions = Version.where(:project_id => project, :status => "open").map{|version| version.name}.unshift(["里程碑", 0]) + versions = Version.where(:project_id => project, :status => "open").map{|version| [version.name, version.id]}.unshift(["里程碑", 0]) end + def render_issue_subject_with_tree(issue) s = '' ancestors = issue.root? ? [] : issue.ancestors.visible.all diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 43d01a5dd..dc962b8b0 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -255,16 +255,18 @@ module QueriesHelper # Give it a name, required to be valid @query = IssueQuery.new(:name => "_") @query.project = @project - params[:f] = %w(subject status_id priority_id author_id assigned_to_id created_on) unless params[:status_id].nil? + params[:f] = %w(subject tracker_id status_id priority_id assigned_to_id fixed_version_id created_on) 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' ? "!":"=" ), + '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]], 'priority_id' => [params[:priority_id]], - 'author_id' => [params[:author_id]], + 'tracker_id' => [params[:tracker_id]], + 'fixed_version_id' => [params[:fixed_version_id]], 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? if(params[:status_id] != nil) if( params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='' && diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index c44aa88bb..492c5407b 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -152,7 +152,16 @@ {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"w90 mr18"} ) %> - <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), + + <%= 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"}) %> + + <%= 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"}) %> + + <%#= 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",:class=>"w90 mr18"} @@ -160,6 +169,8 @@ %> + + <%#= 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"}) %> @@ -172,12 +183,16 @@ {:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0}, {:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "f1"}) %> - <%#= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + <%#= 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,: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"}) %> + <%#= 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"}) %> @@ -188,17 +203,17 @@
- <% if @issues.empty? %> -

<%= l(:label_no_data) %>

- <% else %> -
- <%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> -
- <% end %> - <%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> - - <% end %> <% end %> + <% if @issues.empty? %> +

<%= l(:label_no_data) %>

+ <% else %> +
+ <%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> +
+ <% end %> + <%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> + + \ No newline at end of file diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb index c611706b2..0b4130ea7 100644 --- a/app/views/issues/index.js.erb +++ b/app/views/issues/index.js.erb @@ -1,4 +1,4 @@ //$("#issue_list").html("<%#= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>"); -$("#issue_list").replaceWith("<%= escape_javascript(render :partial => 'issues/all_list',:locals => {:issues => @issues, :query => @query, :issue_pages=> @issue_pages, :issue_count => @issue_count, :project=> @project})%>"); +$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/all_list',:locals => {:issues => @issues, :query => @query, :issue_pages=> @issue_pages, :issue_count => @issue_count, :project=> @project})%>"); $("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');