diff --git a/app/views/users/user_manage_issues.html.erb b/app/views/users/user_manage_issues.html.erb
index 4376419ac..2980c6794 100644
--- a/app/views/users/user_manage_issues.html.erb
+++ b/app/views/users/user_manage_issues.html.erb
@@ -169,6 +169,10 @@
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
+ $("#reorder_turnover_time").removeClass("sortArrowActiveU");
+ $("#reorder_turnover_time").removeClass("sortArrowActiveD");
+ $("#reorder_release_time").addClass("sortArrowActiveD");
+ $("#reorder_release_time").removeClass("sortArrowActiveU");
remote_function();
}
function add_class(id){
@@ -177,21 +181,23 @@
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
- url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=asc&page='+<%= @issue_pages.page%>
-
+ url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=asc&page='+<%= @issue_pages.page %>,
+ data: $("#issue_query_form").serialize()
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
$("#"+id).removeClass("sortArrowActiveU");
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
- url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page %>
+ url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page %>,
+ data: $("#issue_query_form").serialize()
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
- url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page%>
+ url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page%>,
+ data: $("#issue_query_form").serialize()
});
}
}
@@ -212,7 +218,7 @@
-
我收到的Issue
+ 我发布的Issue
- <%= form_tag( user_manage_issues_user_path(@user), :remote=>'xls', :method => "post", :id=>"issue_query_form", :class => 'query_form') do %>
+ <%= form_tag( user_manage_issues_user_path(@user), :remote => 'xls', :method => "post", :id => "issue_query_form", :class => 'query_form') do %>
@@ -250,7 +256,7 @@
<%= 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 => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
+ { :onchange => "remote_function();add_style();", :id => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
)%>
<%= 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;"} )
+ {:onchange=>"remote_function();add_style();",:id => "assigned_to_id",:name => "assigned_to_id", :class => "fl", :style => "visibility:hidden; width:0px;margin:0px;padding:0px;"} )
%>
diff --git a/app/views/users/_my_receive_issue_list.html.erb b/app/views/users/_my_receive_issue_list.html.erb
new file mode 100644
index 000000000..820c4fbad
--- /dev/null
+++ b/app/views/users/_my_receive_issue_list.html.erb
@@ -0,0 +1,84 @@
+<% unless activity.author.nil? %>
+
+
+ <% if activity.status_id.to_i == 5 %>
+
+ <% else %>
+
+ <% end %>
+
+
+
+
+
<%= format_time(activity.created_on) %> 发布
+
<%= format_time(activity.updated_on) %> 更新
+
+
+
+ -
+ <%= Project.find(activity.project_id).name %>
+
+ -
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id)%>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id)%>
+ <% end %>
+
+ -
+ <% case activity.tracker_id %>
+ <% when 1 %>
+ 缺陷
+ <% when 2 %>
+ 功能
+ <% when 3 %>
+ 支持
+ <% when 4 %>
+ 任务
+ <% when 5 %>
+ 周报
+ <% end %>
+
+ -
+ <%= activity.priority.name %>
+
+
+ - <%= activity.fixed_version %>
+ - <%= activity.status.name %>
+ - <%= activity.done_ratio %>%
+ -
+ <% if activity.journals.count > 0 %>
+
+ <%= activity.journals.count %>
+ <% end %>
+
+
+
+<% end %>
+
+
+
diff --git a/app/views/users/_user_receive_issues_list.html.erb b/app/views/users/_user_receive_issues_list.html.erb
new file mode 100644
index 000000000..b6181668c
--- /dev/null
+++ b/app/views/users/_user_receive_issues_list.html.erb
@@ -0,0 +1,24 @@
+<% issue_list(issues) do |issue| -%>
+
+ <%= render :partial => 'users/my_receive_issue_list', :locals => {:activity => issue, :user_activity_id => issue.id} %>
+<% end %>
+
+
+
+
+ <%= link_to "导出EXCEL", user_manage_issues_user_path(:format => 'xls'), :class => "hw_btn_blue ml10 mt10 mb10", :id => "sendexcel",
+ :onclick => "remote_function_export('#{User.current}')"%>
+
+
+
+
+
diff --git a/app/views/users/user_manage_issues.html.erb b/app/views/users/user_manage_issues.html.erb
index 2980c6794..6a69800e1 100644
--- a/app/views/users/user_manage_issues.html.erb
+++ b/app/views/users/user_manage_issues.html.erb
@@ -170,8 +170,8 @@
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
$("#reorder_turnover_time").removeClass("sortArrowActiveU");
- $("#reorder_turnover_time").removeClass("sortArrowActiveD");
- $("#reorder_release_time").addClass("sortArrowActiveD");
+ $("#reorder_turnover_time").addClass("sortArrowActiveD");
+ $("#reorder_release_time").removeClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveU");
remote_function();
}
@@ -239,8 +239,8 @@
清除
diff --git a/app/views/users/user_receive_issues.html.erb b/app/views/users/user_receive_issues.html.erb
new file mode 100644
index 000000000..883b77688
--- /dev/null
+++ b/app/views/users/user_receive_issues.html.erb
@@ -0,0 +1,313 @@
+<%= content_for(:header_tags) do %>
+ <%= import_ke(enable_at: true,init_activity: true) %>
+<% end %>
+
+
+
+
+
+
+
我收到的Issue
+
+
+ <%= form_tag( user_receive_issues_user_path(@user), :remote => 'xls', :method => "post", :id => "issue_query_form", :class => 'query_form') do %>
+
+
+
+
+ -
+ 搜索结果
+ <%= render :partial => "users/my_issue_filter_all" %>
+
+
+
+
+
+ <%= 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 => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
+ )%>
+
+ <%= 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;"}
+ )
+ %>
+
+
+
+
+
+
+
+
+
+ <% end %>
+ <% if @issues.empty? %>
+
<%= l(:label_no_data) %>
+ <% else %>
+
+ <%= render :partial => 'users/user_receive_issues_list', :locals => {:issues => @issues, :issue_pages => @issue_pages, :issue_count => @issue_count, :subject => @subject } %>
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/users/user_receive_issues.js.erb b/app/views/users/user_receive_issues.js.erb
new file mode 100644
index 000000000..41f8ac63c
--- /dev/null
+++ b/app/views/users/user_receive_issues.js.erb
@@ -0,0 +1,3 @@
+$("#issue_filter_all").html("<%= escape_javascript(render :partial => 'users/my_issue_filter_all') %>");
+$("#issue_list").html("<%= escape_javascript(render :partial => 'users/user_receive_issues_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 7a65d8af8..5e2217e38 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -738,6 +738,7 @@ RedmineApp::Application.routes.draw do
get "user_resource"
match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues"
+ match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_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 9c9f0deeb..20fbd0168 100644
--- a/public/stylesheets/css/common.css
+++ b/public/stylesheets/css/common.css
@@ -248,6 +248,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w56 {width:56px;}
.w60{ width:60px;}
.w61{ width:61px;}
+.w65{ width:65px;}
.w70{ width:70px;}
.w80{ width:80px;}
.w90{ width:90px;}
From ddd88d8b95f05f3555032441d8cbd631697135cd Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 4 Jan 2017 13:41:39 +0800
Subject: [PATCH 04/15] =?UTF-8?q?=E9=A1=B9=E7=9B=AEPullRequest=E6=B2=A1?=
=?UTF-8?q?=E6=9C=89=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=E6=97=B6=EF=BC=8C?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/pull_requests/_pull_requests_list.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb
index ed665c457..5e79a150b 100644
--- a/app/views/pull_requests/_pull_requests_list.html.erb
+++ b/app/views/pull_requests/_pull_requests_list.html.erb
@@ -1,5 +1,5 @@
<% if @requests.blank? %>
-
没有可显示的请求
+ <%= render :partial => "projects/no_data" %>
<% else %>
<% @requests.each do |request| %>
From f2229794f213c9ad6e850da94e5f6cc079ca9f0c Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 4 Jan 2017 13:48:58 +0800
Subject: [PATCH 05/15] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84issue=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E2=80=9C=E9=87=8C=E7=A8=8B=E7=A2=91=E2=80=9D=E7=9A=84?=
=?UTF-8?q?=E4=B8=8B=E6=8B=89=E9=80=89=E9=A1=B9=E4=B8=AD=EF=BC=8C=E6=8C=89?=
=?UTF-8?q?=E7=85=A7=E5=8E=86=E7=A8=8B=E7=9A=84=E5=88=9B=E5=BB=BA=E6=97=B6?=
=?UTF-8?q?=E9=97=B4=E5=80=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/issues_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index bda7831fe..b2fd4161c 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -130,7 +130,7 @@ module IssuesHelper
end
def options_for_version_isuue_list(project)
- versions = Version.where(:project_id => project, :status => "open").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
+ versions = Version.where(:project_id => project, :status => "open").order("created_on desc").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
end
def render_issue_subject_with_tree(issue)
From 111bf5a140df3208b939d2d079cf38c75807dca1 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 4 Jan 2017 14:49:21 +0800
Subject: [PATCH 06/15] =?UTF-8?q?=E6=96=B0=E6=B3=A8=E5=86=8C=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=EF=BC=8C=E8=AF=BE=E7=A8=8B=EF=BC=8C=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=EF=BC=8C=E7=AB=9E=E8=B5=9B=E6=95=B0=E6=8D=AE=E4=B8=BA=E7=A9=BA?=
=?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/new_base_user.html.erb | 54 ++++++++++++++----------
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index c5c56cd26..89aa5f276 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -159,7 +159,7 @@
<% if is_current_user %>
- <% if hidden_unproject_infos %>
+ <% if hidden_unproject_infos && user_course_count > 0 %>
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %>
@@ -183,26 +183,32 @@
<%# end %>
<% end %>
-
-
- <%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %>
-
-
- -
- <%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目",
- user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
-
- -
- <%= link_to issues_author_is_self_count > 0 ? "我发布的issue#{issues_author_is_self_count}".html_safe : "我发布的issue",
- user_manage_issues_user_path(@user), :target => "_blank" %>
-
- -
- <%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue#{issues_assigned_is_self_count}".html_safe : "我收到的issue",
- user_receive_issues_user_path(@user), :target => "_blank" %>
-
-
-
- <% if hidden_unproject_infos %>
+ <% if user_project_count > 0%>
+
+
+ <%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %>
+
+
+ -
+ <%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目",
+ user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
+
+ <% if issues_author_is_self_count > 0 %>
+ -
+ <%= link_to issues_author_is_self_count > 0 ? "我发布的issue#{issues_author_is_self_count}".html_safe : "我发布的issue",
+ user_manage_issues_user_path(@user), :target => "_blank" %>
+
+ <% end %>
+ <% if issues_assigned_is_self_count > 0 %>
+ -
+ <%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue#{issues_assigned_is_self_count}".html_safe : "我收到的issue",
+ user_receive_issues_user_path(@user), :target => "_blank" %>
+
+ <% end %>
+
+
+ <% end %>
+ <% if hidden_unproject_infos && user_contest_count > 0 %>
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
@@ -222,17 +228,19 @@
<%= time_tag(@user.created_on).html_safe %>
- <% if hidden_unproject_infos %>
+ <% if hidden_unproject_infos && user_course_count > 0 %>
-
<%= link_to user_course_count > 0 ? "课程#{user_course_count}".html_safe : "课程",
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
<% end %>
+ <% if user_project_count > 0 %>
-
<%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目",
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
- <% if hidden_unproject_infos %>
+ <% end %>
+ <% if hidden_unproject_infos && user_contest_count > 0 %>
-
<%= link_to user_contest_count > 0 ? "竞赛#{user_contest_count}".html_safe : "竞赛",
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>
From e43ef02d579126d427aaa80865ad0f3b3b6190d2 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 5 Jan 2017 09:06:41 +0800
Subject: [PATCH 07/15] =?UTF-8?q?=E6=88=91=E5=8F=91=E5=B8=83=E7=9A=84?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 35 +++++++++++++++-
app/helpers/application_helper.rb | 9 ++++
app/views/layouts/new_base_user.html.erb | 8 +++-
.../users/_manage_homework_list.html.erb | 32 ++++----------
app/views/users/_my_homework_sort.html.erb | 8 ++--
app/views/users/_my_homeworks_search.html.erb | 4 +-
.../users/user_manage_homeworks.html.erb | 42 +++++++++++++++++++
app/views/users/user_manage_homeworks.js.erb | 7 ++++
config/routes.rb | 1 +
public/stylesheets/css/common.css | 3 ++
10 files changed, 118 insertions(+), 31 deletions(-)
create mode 100644 app/views/users/user_manage_homeworks.html.erb
create mode 100644 app/views/users/user_manage_homeworks.js.erb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index c49b83f0b..3ed496d2f 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -35,7 +35,7 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
- before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list,
+ before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
@@ -1830,6 +1830,39 @@ end
end
end
+ # 用户发布的作业
+ def user_manage_homeworks
+ @manage_homeworks = "我发布的作业"
+ @order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 1
+ @r_sort = @b_sort == "desc" ? "asc" : "desc"
+ @type = @type.to_i
+ tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
+ tea_course_ids = tea_courses.empty? ? "(-1)" : "(" + tea_courses.map{|course| course.id}.join(',') + ")"
+ @homeworks = HomeworkCommon.where("course_id in #{tea_course_ids}").order("#{@order} #{@b_sort}")
+ if params[:property]
+ all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
+ if params[:property] == "1"
+ @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
+ elsif params[:property] == "2"
+ @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
+ elsif params[:property] == "3"
+ @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
+ end
+ end
+ @limit = 10
+ @is_remote = true
+ @hw_count = @homeworks.count
+ @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
+ @offset ||= @hw_pages.offset
+ @homeworks = paginateHelper @homeworks,@limit
+ @search = ""
+ @property = params[:property]
+ respond_to do |format|
+ format.js
+ format.html {render :layout => 'static_base'}
+ end
+ end
+
#我管理/收到的作业
def manage_or_receive_homeworks
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc",params[:type] || 1
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a48c3991a..bd9f110be 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1352,6 +1352,8 @@ module ApplicationHelper
title << @manage_issues
elsif !@receive_issues.blank?
title << @receive_issues
+ elsif !@manage_homeworks.blank?
+ title << @manage_homeworks
else
title << @user.try(:realname)
end
@@ -2924,6 +2926,13 @@ module ApplicationHelper
@user_course_total = @my_joined_course_count + @my_course_count
end
+ # 用户发布的作业数
+ def user_manage_homework_count
+ tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
+ tea_course_ids = tea_courses.map{|course| course.id}
+ @manage_homeworks = HomeworkCommon.where(:course_id => tea_course_ids).count
+ end
+
# 用户发布的issue数
def issues_author_is_self_count
@issues = Issue.where( :author_id => @user.id )
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 89aa5f276..6cda91e36 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -170,8 +170,14 @@
<%= link_to user_course_count > 0 ? "课程#{user_course_count}".html_safe : "课程",
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
+ <% if user_manage_homework_count %>
+ -
+ <%= link_to user_manage_homework_count > 0 ? "我发布的作业#{user_manage_homework_count}".html_safe : "我发布的作业",
+ user_manage_homeworks_user_path(@user), :target => "_blank" %>
+
+ <% end %>
-
- <%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
+ <%= link_to '我收到的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
-
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %>
diff --git a/app/views/users/_manage_homework_list.html.erb b/app/views/users/_manage_homework_list.html.erb
index 5a9d8540a..026bacc29 100644
--- a/app/views/users/_manage_homework_list.html.erb
+++ b/app/views/users/_manage_homework_list.html.erb
@@ -5,34 +5,20 @@
<% else %>
<% homeworks.each do |homework| %>
-
+
- <%= link_to homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
+ <%= link_to homework.course.name+" / "+homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
- 来源:
-
- <%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
-
- 类别:<%=homework.homework_type_ch %>
- 作品:
- <%=homework.student_works.has_committed.count %>
- /
- <%= homework.homework_type == 3 ? '--' : homework.course.student.count %>
- 待评阅:
- <%= homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %>
- /
- <%=homework.student_works.has_committed.count %>
- 发布时间:
- <% if homework.publish_time %>
- <%= format_date(homework.publish_time) %>
- <% else %>
- --
- <% end %>
-
- <%=(cur_homework_end_time homework).html_safe %>
+ <%= (cur_homework_end_time homework).html_safe %>
+ 未交:
+ <%= homework.homework_type == 3 ? '--' : (homework.course.student.count - homework.student_works.has_committed.count) %>
+ 已评:
+ <%= homework.student_works.has_committed.count - homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %>
+ 未评:
+ <%= homework.student_works.has_committed.count %>
<% if homework.student_works.has_committed.count == 0 %>
diff --git a/app/views/users/_my_homework_sort.html.erb b/app/views/users/_my_homework_sort.html.erb
index e32838bd5..23d07b977 100644
--- a/app/views/users/_my_homework_sort.html.erb
+++ b/app/views/users/_my_homework_sort.html.erb
@@ -1,13 +1,13 @@
排序:
<% if type == 1 %>
- <%= link_to "发布时间",search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
+ <%= link_to "发布时间",search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property => property,:order => "publish_time", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
<% if order == "publish_time" %>
- <%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
+ <%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type, :property => property,:order => "publish_time", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<% else %>
- <%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
+ <%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property => property,:order => "publish_time", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
<% end %>
<% else %>
- <%= link_to "状态", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "status", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
+ <%= link_to "状态", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property => property,:order => "status", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
<% if order == "status" %>
<%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "status", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<% else %>
diff --git a/app/views/users/_my_homeworks_search.html.erb b/app/views/users/_my_homeworks_search.html.erb
index 2a6902083..de618d479 100644
--- a/app/views/users/_my_homeworks_search.html.erb
+++ b/app/views/users/_my_homeworks_search.html.erb
@@ -3,7 +3,7 @@
-
+
@@ -17,7 +17,7 @@
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
- url: '<%= url_for(:controller => 'users', :action => 'search_m_r_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>&property=<%=property %>',
+ url: '<%= url_for(:controller => 'users', :action => 'search_m_r_homeworks') %>'+'?name='+ e.target.value+'&type=<%= type %>&property=<%= property %>',
type:'get'
});
}
diff --git a/app/views/users/user_manage_homeworks.html.erb b/app/views/users/user_manage_homeworks.html.erb
new file mode 100644
index 000000000..4a7b2419b
--- /dev/null
+++ b/app/views/users/user_manage_homeworks.html.erb
@@ -0,0 +1,42 @@
+
+
+
+
+
+ <%=render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
+
+
+
+ <%= render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1} %>
+
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/user_manage_homeworks.js.erb b/app/views/users/user_manage_homeworks.js.erb
new file mode 100644
index 000000000..1ddc4687d
--- /dev/null
+++ b/app/views/users/user_manage_homeworks.js.erb
@@ -0,0 +1,7 @@
+$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1})%>');
+$("#homework_list_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
+$("#my_homework_sort").html('<%= escape_javascript( render :partial => 'users/my_homework_sort', :locals => {:type => @type,:property => @property,:order => @order,:search => @search})%>');
+$("#homework_type_all").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>');
+$("#homework_type_nor").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>');
+$("#homework_type_pro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>');
+$("#homework_type_gro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>');
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 5e2217e38..30721bdd5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -739,6 +739,7 @@ RedmineApp::Application.routes.draw do
match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues"
match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_issues"
+ match "user_manage_homeworks", :to => 'users#user_manage_homeworks', :via => [:get, :post], :as => "user_manage_homeworks"
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 20fbd0168..1b1c45e1b 100644
--- a/public/stylesheets/css/common.css
+++ b/public/stylesheets/css/common.css
@@ -879,3 +879,6 @@ input.btn-blue{background: #3b94d6; color: #fff; cursor:pointer;}
input:hover.btn-blue{background: #2788d0; color: #fff;}
input.btn-grey{background: #d9d9d9; color: #656565; cursor:default;}
input.btn-grey:hover{background: #717171; color: #fff; cursor:default;}
+.icons-user-homework{background:url(/images/user/home-user-left.png) 0px -150px no-repeat; }
+.homework-user-leftnav-li{ height: 25px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 0px -149px no-repeat; font-size: 14px; position: relative; }
+.homework-user-leftnav-li:hover{ height: 25px; line-height: 40px; padding-left: 25px; background:#f4f4f4; background:url(/images/user/home-user-left.png) 0px -186px no-repeat; font-size: 14px; position: relative; }
From 5cc362e6eb6a39badecd8d926008dfbdd950623f Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 5 Jan 2017 10:14:56 +0800
Subject: [PATCH 08/15] =?UTF-8?q?=E6=88=91=E6=94=B6=E5=88=B0=E7=9A=84?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 35 +++++++++++++++-
app/helpers/application_helper.rb | 9 ++++
.../layouts/base_course_community.html.erb | 5 ++-
.../layouts/base_project_community.html.erb | 5 ++-
app/views/layouts/new_base_user.html.erb | 9 ++--
.../users/_receive_homework_list.html.erb | 13 ++----
.../users/user_manage_homeworks.html.erb | 2 +-
.../users/user_receive_homeworks.html.erb | 42 +++++++++++++++++++
app/views/users/user_receive_homeworks.js.erb | 7 ++++
config/routes.rb | 1 +
10 files changed, 111 insertions(+), 17 deletions(-)
create mode 100644 app/views/users/user_receive_homeworks.html.erb
create mode 100644 app/views/users/user_receive_homeworks.js.erb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 3ed496d2f..3c44cac57 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -37,7 +37,7 @@ class UsersController < ApplicationController
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
- :anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
+ :anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues,
:user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
@@ -1863,6 +1863,39 @@ end
end
end
+ # 用户收到的作业
+ def user_receive_homeworks
+ @receive_homeworks = "我收到的作业"
+ @order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 2
+ @r_sort = @b_sort == "desc" ? "asc" : "desc"
+ @type = @type.to_i
+ stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
+ stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
+ @homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
+ if params[:property]
+ all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
+ if params[:property] == "1"
+ @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
+ elsif params[:property] == "2"
+ @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
+ elsif params[:property] == "3"
+ @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
+ end
+ end
+ @limit = 10
+ @is_remote = true
+ @hw_count = @homeworks.count
+ @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
+ @offset ||= @hw_pages.offset
+ @homeworks = paginateHelper @homeworks,@limit
+ @search = ""
+ @property = params[:property]
+ respond_to do |format|
+ format.js
+ format.html {render :layout => 'static_base'}
+ end
+ end
+
#我管理/收到的作业
def manage_or_receive_homeworks
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc",params[:type] || 1
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index bd9f110be..df785c2ae 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1354,6 +1354,8 @@ module ApplicationHelper
title << @receive_issues
elsif !@manage_homeworks.blank?
title << @manage_homeworks
+ elsif !@receive_homeworks.blank?
+ title << @receive_homeworks
else
title << @user.try(:realname)
end
@@ -2933,6 +2935,13 @@ module ApplicationHelper
@manage_homeworks = HomeworkCommon.where(:course_id => tea_course_ids).count
end
+ # 用户收到的作业数
+ def user_receive_homework_count
+ stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
+ stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
+ @homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").count
+ end
+
# 用户发布的issue数
def issues_author_is_self_count
@issues = Issue.where( :author_id => @user.id )
diff --git a/app/views/layouts/base_course_community.html.erb b/app/views/layouts/base_course_community.html.erb
index 8eed02482..e769f8803 100644
--- a/app/views/layouts/base_course_community.html.erb
+++ b/app/views/layouts/base_course_community.html.erb
@@ -71,7 +71,10 @@
<% if @user == User.current %>
-
- <%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
+ <%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
+
+ -
+ <%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
-
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>
diff --git a/app/views/layouts/base_project_community.html.erb b/app/views/layouts/base_project_community.html.erb
index ee8ed23db..357cfddb3 100644
--- a/app/views/layouts/base_project_community.html.erb
+++ b/app/views/layouts/base_project_community.html.erb
@@ -62,7 +62,10 @@
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
-
- <%= link_to "我的Issue", user_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
+ <%= link_to "我发布的issue", user_manage_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
+
+ -
+ <%= link_to "我收到的issue", user_receive_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
<% end %>
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 6cda91e36..aa17b1ae8 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -176,9 +176,12 @@
user_manage_homeworks_user_path(@user), :target => "_blank" %>
<% end %>
-
- <%= link_to '我收到的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
-
+ <% if user_receive_homework_count > 0 %>
+
+ <%= link_to "我收到的作业#{user_receive_homework_count}".html_safe,
+ user_receive_homeworks_user_path(@user), :target => "_blank" %>
+
+ <% end %>
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %>
diff --git a/app/views/users/_receive_homework_list.html.erb b/app/views/users/_receive_homework_list.html.erb
index c5b073ee2..70de76eb9 100644
--- a/app/views/users/_receive_homework_list.html.erb
+++ b/app/views/users/_receive_homework_list.html.erb
@@ -5,29 +5,22 @@
<% else %>
<% homeworks.each do |homework| %>
-
+
- <%= link_to homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
+ <%= link_to homework.course.name + " / " +homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
- 来源:
-
- <%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
-
- 类别:<%=homework.homework_type_ch %>
+ <%= cur_homework_end_time homework %>
<% my_work = homework.student_works.where("user_id = ? && work_status != 0",User.current).first %>
状态:<%= my_work ? '已提交' : '未提交' %>
- 作品:<%=homework.student_works.has_committed.count %>
成绩:
<% if my_work && !my_work.work_score.nil? %>
<%= format("%.1f",my_work.work_score.to_f) %>
<% else %>
--
<% end %>
- 发布时间:<%= format_date homework.publish_time %>
- <%=cur_homework_end_time homework %>
<%= student_for_homework_common homework %>
diff --git a/app/views/users/user_manage_homeworks.html.erb b/app/views/users/user_manage_homeworks.html.erb
index 4a7b2419b..83bd70ab6 100644
--- a/app/views/users/user_manage_homeworks.html.erb
+++ b/app/views/users/user_manage_homeworks.html.erb
@@ -23,7 +23,7 @@
- <%=render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
+ <%= render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
diff --git a/app/views/users/user_receive_homeworks.html.erb b/app/views/users/user_receive_homeworks.html.erb
new file mode 100644
index 000000000..58a79ba5c
--- /dev/null
+++ b/app/views/users/user_receive_homeworks.html.erb
@@ -0,0 +1,42 @@
+
+
+
+
+
+ <%= render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
+
+
+
+ <%= render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks} %>
+
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/user_receive_homeworks.js.erb b/app/views/users/user_receive_homeworks.js.erb
new file mode 100644
index 000000000..3ffbfaaa3
--- /dev/null
+++ b/app/views/users/user_receive_homeworks.js.erb
@@ -0,0 +1,7 @@
+$("#my_homework_list").html('<%= escape_javascript(render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks})%>');
+$("#homework_list_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
+$("#my_homework_sort").html('<%= escape_javascript( render :partial => 'users/my_homework_sort', :locals => {:type => @type,:property => @property,:order => @order,:search => @search})%>');
+$("#homework_type_all").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>');
+$("#homework_type_nor").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>');
+$("#homework_type_pro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>');
+$("#homework_type_gro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>');
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 30721bdd5..f2ef4f43e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -740,6 +740,7 @@ RedmineApp::Application.routes.draw do
match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues"
match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_issues"
match "user_manage_homeworks", :to => 'users#user_manage_homeworks', :via => [:get, :post], :as => "user_manage_homeworks"
+ match "user_receive_homeworks", :to =>'users#user_receive_homeworks', :via => [:get, :post], :as => "user_receive_homeworks"
get "import_resources"
get "import_resources_search"
post "import_into_container"
From 602870069fb2e06aef63986d2c9a34ddf6695e32 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 5 Jan 2017 13:35:19 +0800
Subject: [PATCH 09/15] =?UTF-8?q?=E5=B0=86pullrequest=E6=B6=88=E6=81=AF?=
=?UTF-8?q?=E6=94=BE=E5=85=A5=E5=B0=8F=E9=93=83=E9=93=9B=E5=86=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/pull_requests_controller.rb | 2 +-
app/controllers/users_controller.rb | 2 +-
app/views/layouts/_show_messages_list.html.erb | 8 ++++++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb
index 8784a2811..20d7eb15c 100644
--- a/app/controllers/pull_requests_controller.rb
+++ b/app/controllers/pull_requests_controller.rb
@@ -360,7 +360,7 @@ class PullRequestsController < ApplicationController
:project_id => project_id,
:forge_message_id => pull_request_id,
:forge_message_type => "PullRequest",
- :viewed => true,
+ :viewed => false,
:status => status,
:operate_user_id => User.current.id,
)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 3c44cac57..4f723fb28 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -454,7 +454,7 @@ end
messages.each do |message_all|
# 未读的消息存放在数组
mess = message_all.message
- if (message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
+ if (message_all.message_type != "SystemMessage" && !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
diff --git a/app/views/layouts/_show_messages_list.html.erb b/app/views/layouts/_show_messages_list.html.erb
index e0ec673c1..00bf175a0 100644
--- a/app/views/layouts/_show_messages_list.html.erb
+++ b/app/views/layouts/_show_messages_list.html.erb
@@ -150,6 +150,10 @@
- <%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>
<% elsif ma.forge_message_type == "Comment" %>
- <%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>
+ <% elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
+ <% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
+ <% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
+
- <%= User.find(author.id).show_name %> <%= pull_request_message_status(ma) %> <%= send_message_user[0].title %>
<% end %>
<% elsif ma.class == MemoMessage %>
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
@@ -179,8 +183,8 @@
<% end %>
<% end %>
-
展开更多
-<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :style => "display:none", :target =>"_Blank" %>
+
+<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :target =>"_Blank" %>