From e956d20d6eccb538981ac3d66ded87ad8f424ead Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 16 Nov 2016 16:57:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84issue=E9=83=A8=E5=88=86?= =?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 | 12 ++-- app/helpers/users_helper.rb | 5 ++ app/views/users/_all_issue_list.html.erb | 16 ------ app/views/users/_my_issue_filter_all.html.erb | 1 + app/views/users/_my_issue_list.html.erb | 56 ++++++++++++------- app/views/users/user_issues.html.erb | 27 +++++---- app/views/users/user_issues.js.erb | 2 +- config/routes.rb | 2 +- public/stylesheets/css/common.css | 6 +- 9 files changed, 70 insertions(+), 57 deletions(-) create mode 100644 app/views/users/_my_issue_filter_all.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 54a2c59ad..70e4a3124 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -92,17 +92,21 @@ class UsersController < ApplicationController def user_issues @subject = params[:subject] author_id = params[:author_id] - #@issues = Issue.where("author_id =? or assigned_to_id =? and subject like ?", (author_id ? author_id : @user.id) , @user.id, "%#{@subject}%") + 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') + 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') + end @issues_filter = Issue.where("author_id =? or assigned_to_id =?", (author_id ? author_id : @user.id) , @user).order('updated_on desc') @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_filter.count + @issue_count = @issues.count @limit = 10 @is_remote = true @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1 @offset ||= @issue_pages.offset - @issues = paginateHelper @issues_filter, @limit - + @issues = paginateHelper @issues, @limit respond_to do |format| format.html{render :layout => 'static_base'} format.api diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 4c178c543..c81b3b84e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -40,6 +40,11 @@ module UsersHelper end end + 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 + 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 3c21dc3c8..a3554b7e2 100644 --- a/app/views/users/_all_issue_list.html.erb +++ b/app/views/users/_all_issue_list.html.erb @@ -6,19 +6,3 @@ <%= render :partial => 'users/my_issue_list', :locals => {:activity => issue, :user_activity_id => issue.id} %> <% end %> - -
<%= format_time(activity.created_on) %> 发布
+<%= format_time(activity.created_on) %> 发布
<%= format_time(activity.updated_on) %> 更新