+
+
+ <%= 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 mr10"}
+ )%>
发布人
@@ -243,14 +246,14 @@
排序
-
+
<% end %>
<% if @issues.empty? %>
<%= l(:label_no_data) %>
<% else %>
- <%#= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
+ <%= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
<% end %>
diff --git a/app/views/users/user_issues.js.erb b/app/views/users/user_issues.js.erb
index 97b9f760d..0c7f67ac1 100644
--- a/app/views/users/user_issues.js.erb
+++ b/app/views/users/user_issues.js.erb
@@ -1,3 +1,3 @@
-/*$("#issue_filter_all").html("<%#= escape_javascript(render :partial => 'issues/issue_filter_all') %>");*/
+$("#issue_filter_all").html("<%= escape_javascript(render :partial => 'users/my_issue_filter_all') %>");
$("#issue_list").html("<%= escape_javascript(render :partial => 'users/all_issue_list',:locals => {:issues => @issues, :issue_pages=> @issue_pages, :issue_count => @issue_count })%>");
$("#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 %>');
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 48fc637b8..df7bdb3b1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -638,7 +638,7 @@ RedmineApp::Application.routes.draw do
get 'edit_brief_introduction'
get "user_resource"
- get "user_issues", :to => 'users#user_issues', :via => :get, :as => "user_issues"
+ match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
get "import_resources"
get "import_resources_search"
post "import_into_container"
diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css
index 973f7a7b9..4ca947af4 100644
--- a/public/stylesheets/css/common.css
+++ b/public/stylesheets/css/common.css
@@ -718,9 +718,9 @@ input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;}
a.issues_list_title{ color:#444; max-width:260px; overflow:hidden; text-overflow:ellipsis; -o-text-overflow:ellipsis; white-space:nowrap; }
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/project/icons_issue.png") 0 0 no-repeat;}
-.issues_ciricons_02{ width: 22px; height: 22px; display: inline-block; background: url("../images/project/icons_issue.png") 0 -30px no-repeat;}
-.issues_icons_mes{width: 17px; height: 17px; display: inline-block; background: url("../images/project/icons_issue.png") 0 -57px no-repeat; }
+.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: 17px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -57px no-repeat; }
.issues_list_name{ font-size: 12px;}
.issues_list_name:hover{ color: #3b94d6;}
.issues_list_small{ font-size: 12px; color: #666;}
From d65a06273745296263ba5ac849bdf21a54c2c9ac Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 17 Nov 2016 17:02:02 +0800
Subject: [PATCH 14/16] =?UTF-8?q?=E6=89=80=E6=9C=89=E6=88=91=E7=9A=84issue?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 32 +++++++++-
app/helpers/users_helper.rb | 8 +++
app/views/users/_all_issue_list.html.erb | 14 +++++
.../users/_my_issue_assigned_filter.html.erb | 1 +
app/views/users/user_issues.html.erb | 63 +++++++++++--------
public/stylesheets/css/common.css | 12 +++-
6 files changed, 99 insertions(+), 31 deletions(-)
create mode 100644 app/views/users/_my_issue_assigned_filter.html.erb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 70e4a3124..56b536d30 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -91,14 +91,40 @@ class UsersController < ApplicationController
# subject 主题:搜索用(注意:搜索和列表调用同一方法,通过参数或者remote区分)
def user_issues
@subject = params[:subject]
- author_id = params[:author_id]
+ # author_id = params[:author_id]
+ params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
+ params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
- @issues = Issue.where("(author_id =? or assigned_to_id =? ) and subject like ?", (author_id ? author_id : @user.id) , @user.id, "%#{@subject}%").order('updated_on desc')
+ if @assigned_to.nil?
+ if author_id.nil?
+ @issues = Issue.where("(author_id =? or assigned_to_id =? ) and subject like ?",
+ @user.id , @user.id, "%#{@subject}%").order('updated_on desc')
+ else
+ @issues = Issue.where("author_id =? and subject like ?",
+ author_id , "%#{@subject}%").order('updated_on desc')
+ end
+ else
+ @issues = Issue.where("assigned_to_id =? and subject like ?", @assigned_to, "%#{@subject}%").order('updated_on desc')
+ end
+
else
- @issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?", (author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
+ if @assigned_to.nil?
+ if author_id.nil?
+ @issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?",
+ (author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
+ else
+ @issues = Issue.where("author_id =? and project_id=? and subject like ?",
+ author_id , @project_id, "%#{@subject}%").order('updated_on desc')
+ end
+ else
+ @issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
+ @assigned_to, @project_id, "%#{@subject}%").order('updated_on desc')
+ end
end
@issues_filter = Issue.where("author_id =? or assigned_to_id =?", (author_id ? author_id : @user.id) , @user).order('updated_on desc')
+ @issues_assigned_count = Issue.where("assigned_to_id =? and subject like ?", @user.id, "%#{@subject}%").count
+ @issues_author_count = Issue.where("author_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issue_open_count = Issue.where(" (author_id =? or assigned_to_id =?) and status_id in (1,2,3,4,6)", (author_id ? author_id : @user.id) , @user).count
@issue_close_count = Issue.where("(author_id =? or assigned_to_id =?) and status_id = 5", (author_id ? author_id : @user.id) , @user.id).count
@issue_count = @issues.count
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index c81b3b84e..228e83080 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -40,11 +40,19 @@ module UsersHelper
end
end
+ # 我的issue 来源
def options_for_issue_project_list( issues )
issues = issues.group_by{|issue| issue.project_id}
issues.map{ |issue| [Project.find(issue[0]).name, issue[0]]}.unshift(["来源", 0])
end
+ # 我的issue指派给我
+ def options_for_my_issue_list(issues)
+ # issues = issues.group_by{|issue| issue.assigned_to_id }
+ # issues.map{ |issue| [User.find(issue[0]).show_name, issue[0]]}.unshift(["指派给", 0])
+
+ end
+
def get_resource_type type
case type
when 'Course'
diff --git a/app/views/users/_all_issue_list.html.erb b/app/views/users/_all_issue_list.html.erb
index a3554b7e2..02ed8c689 100644
--- a/app/views/users/_all_issue_list.html.erb
+++ b/app/views/users/_all_issue_list.html.erb
@@ -6,3 +6,17 @@
<%= render :partial => 'users/my_issue_list', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %>
+
+
diff --git a/app/views/users/_my_issue_assigned_filter.html.erb b/app/views/users/_my_issue_assigned_filter.html.erb
new file mode 100644
index 000000000..52994bf85
--- /dev/null
+++ b/app/views/users/_my_issue_assigned_filter.html.erb
@@ -0,0 +1 @@
+
<%= @issues_assigned_count %>
\ No newline at end of file
diff --git a/app/views/users/user_issues.html.erb b/app/views/users/user_issues.html.erb
index 3bb5d6e6a..07483694f 100644
--- a/app/views/users/user_issues.html.erb
+++ b/app/views/users/user_issues.html.erb
@@ -4,6 +4,7 @@
-
+
我的缺陷
@@ -199,16 +200,20 @@
@@ -220,34 +225,45 @@
-->
<%= 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 mr10"}
+ { :onchange => "remote_function();add_style();",:id => "proeject_id", :name => "project_id", :class => "fl mr20", :style=>"width:90px;padding-left:40px;"}
)%>
-
+
发布人
-
+ <%= 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( :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;"} )
+ %>
+
优先度
-
+
里程碑
-
+
状态
-
+
完成度
-
+
排序
+
<% end %>
<% if @issues.empty? %>
<%= l(:label_no_data) %>
@@ -256,23 +272,18 @@
<%= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
<% end %>
-
-
+
+