diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index aebc82b14..86c04e9e4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -90,51 +90,60 @@ class UsersController < ApplicationController # order 排序条件 # subject 主题:搜索用(注意:搜索和列表调用同一方法,通过参数或者remote区分) def user_issues - @subject = params[:subject] - # 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? - 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') + @subject = params[:subject] + # 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? + 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("author_id =? and subject like ?", - author_id , "%#{@subject}%").order('updated_on desc') + @issues = Issue.where("assigned_to_id =? and subject like ?", @assigned_to, "%#{@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 - 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') + 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 - 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 - @limit = 10 - @is_remote = true - @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1 - @offset ||= @issue_pages.offset - @issues = paginateHelper @issues, @limit + @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 + + # 导出excel的issues + @excel_issues = @issues + + @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, @limit + respond_to do |format| format.html{render :layout => 'static_base'} + format.xls{ + filename = "我的_#{l(:label_issue_list_xls)}.xls" + send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } format.api format.js end diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb index 59cda2ec1..57a1874ca 100644 --- a/app/views/pull_requests/_pull_requests_list.html.erb +++ b/app/views/pull_requests/_pull_requests_list.html.erb @@ -12,7 +12,7 @@ <%= link_to "", project_pull_request_path(request.id, :project_id => @project.id), :class => "issues_icons_mes fr mr5 ml5" %>
-

由 <%= link_to request.author.try(:username), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前

+

由 <%= link_to User.find(request.author.id).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前

<%= time_tag(request.updated_at) %>前更新

<%= @project.name+"/"+request.source_branch %>合并到<%= request.target_branch %>

diff --git a/app/views/users/_all_issue_list.html.erb b/app/views/users/_all_issue_list.html.erb index cc33fc95d..0e7ccfca2 100644 --- a/app/views/users/_all_issue_list.html.erb +++ b/app/views/users/_all_issue_list.html.erb @@ -10,7 +10,9 @@
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 159da2789..b1936e19b 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -28,8 +28,15 @@ <% end %> <% if ma.course_message_type == "Comment" && ma.course_message %>