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;"} )%> - - - - - - - -
+
<% 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 %> - -
+ +
+
-
-
- ddd -
- - ddd
- + + - diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index 4ca947af4..a5eb0bc6d 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -709,7 +709,8 @@ input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;} .issues_form_filter select.issues_filter_select_min{width:50px; } .issues_form_filter select:focus,.issues_form_filter input:focus{border:none; } .issues_filter_data input{height:28px;width:91px; border:1px solid #c8c8c8;background-color:#fff;} -.issues_form_filter select{appearance:none;-moz-appearance:none;-webkit-appearance:none; background: url("../images/project/arrow.png") no-repeat scroll right center transparent;} +.issues_form_filter select{appearance:none;-moz-appearance:none;-webkit-appearance:none; background: url("/images/new_project/arrow.png") no-repeat scroll right center transparent;} +.issues_form_filter select.my_issues_filter{ background:none; width:70px; padding-right:10px;padding-left:10px;} input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;} .issues_data_img{ display:block; width:25px; height:28px; border:1px solid #c8c8c8; border-left:none; background: url("../images/public_icon.png") -29px 9px no-repeat; } @@ -800,4 +801,11 @@ a:hover.sy_btn_pink{ background: #e64c4c;} select.issues_filter_active { font-weight: bold; color: #333;} .issues_form_filter select.issues_filter_select_min02{width:60px; } .issues_form_filter select.issues_filter_select_max{width:90px; } -.issues_list_txt li.issues_list_max{ width:90px } \ No newline at end of file +.issues_list_txt li.issues_list_max{ width:90px } +.btn_newpro_grey{display: inline-block;color: #7b7b7b; border:1px solid #dbdbdb;background:#fff;text-align: center;font-size: 12px; padding:0 15px; height:24px; line-height: 24px; -webkit-border-radius:3px; -moz-border-radius:3px; -o-border-radius:3px; border-radius:3px;} +a:hover.btn_newpro_grey,a:active.btn_newpro_grey{ background: #eaeaea;} + +.my_issues_form_filter{ position: absolute; top:0; right: 0;} +.my_issues_form_filter select{ width:70px; height:30px; border:none; font-size:14px; border:none;border-right:none; color: #888; font-size: 12px; line-height: 30px; text-align:center} +.my_issues_form_filter select.issues_filter_select_min{width:50px; } +.my_issues_form_filter select{appearance:none;-moz-appearance:none;-webkit-appearance:none;} \ No newline at end of file