From 5531a236fa164caa75cb2e086f3731daaf6a2f79 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 26 Sep 2016 21:02:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E5=AD=97=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 2 ++ app/views/issues/_issue_filter.html.erb | 1 + app/views/issues/_issue_filter_author.html.erb | 1 + app/views/issues/index.html.erb | 16 ++++++++++++---- app/views/issues/index.js.erb | 2 ++ 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 app/views/issues/_issue_filter.html.erb create mode 100644 app/views/issues/_issue_filter_author.html.erb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 3ac0aa166..38cc93fe3 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -101,6 +101,8 @@ class IssuesController < ApplicationController @project_sort = 'issues.updated_on asc' end end + @issues_filter_assign_count = @query.issues.select{|issue| issue.assigned_to_id == User.current.id }.count + @issues_filter_author_count = @query.issues.select{|issue| issue.author_id == User.current.id }.count @issues_filter = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => @project_sort) @limit = 10 @is_remote = true diff --git a/app/views/issues/_issue_filter.html.erb b/app/views/issues/_issue_filter.html.erb new file mode 100644 index 000000000..07ebb047f --- /dev/null +++ b/app/views/issues/_issue_filter.html.erb @@ -0,0 +1 @@ +<%= @issues_filter_assign_count %> \ No newline at end of file diff --git a/app/views/issues/_issue_filter_author.html.erb b/app/views/issues/_issue_filter_author.html.erb new file mode 100644 index 000000000..8b9bed9f9 --- /dev/null +++ b/app/views/issues/_issue_filter_author.html.erb @@ -0,0 +1 @@ +<%= @issues_filter_author_count %><%#= @project.issues.where(:author_id => User.current.id ).visible.all.count %> \ No newline at end of file diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 15599f114..b292d07cc 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -91,8 +91,8 @@
导出EXCEL @@ -127,13 +127,21 @@ 所有<%= @project.project_score.issue_num %>
  • - 指派给我<%= @project.issues.where(:assigned_to_id => User.current.id ).visible.all.count %> + 指派给我 + <%= render :partial => "issues/issue_filter" %> +
  • - 我的发布<%= @project.issues.where(:author_id => User.current.id ).visible.all.count %> + 我的发布 + <%= render :partial => "issues/issue_filter_author" %> +
  • + + + +
    diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb index 0b4130ea7..731145eca 100644 --- a/app/views/issues/index.js.erb +++ b/app/views/issues/index.js.erb @@ -1,4 +1,6 @@ //$("#issue_list").html("<%#= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>"); +$("#issue_assigned_count").html("<%= escape_javascript(render :partial => 'issues/issue_filter') %>"); +$("#issue_author_count").html("<%= escape_javascript(render :partial => 'issues/issue_filter_author') %>"); $("#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 %>');