From ea308736657c38b7a048a26eb22f369d2e37bad7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 29 Nov 2016 17:02:36 +0800 Subject: [PATCH 01/31] =?UTF-8?q?=E5=88=9B=E5=BB=BA=EF=BC=8C=E6=88=96?= =?UTF-8?q?=E5=85=B3=E9=97=ADPullRequest=E6=97=B6=EF=BC=8C=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=B6=88=E6=81=AF=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 13 +++++----- app/views/users/_user_message_forge.html.erb | 25 +++++++++++++------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 0b6a73440..d3d60bf5a 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -98,15 +98,15 @@ class PullRequestsController < ApplicationController @fork_project_name = Project.find(params[:target_project_id]).try(:name) @fork_pr_message = true if @fork_project_name # 发送消息 - #send_message(User.current.id, target_project_id, title) + send_message(User.current.id, target_project_id, request.id) # 创建Trustie数据 - #PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id) + PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id) else request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch) # 发送消息 - #send_message(User.current.id, @project.id, title) + send_message(User.current.id, @project.id, request.id) # 创建Trustie数据 - #PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id) + PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id) respond_to do |format| format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)} end @@ -295,8 +295,9 @@ class PullRequestsController < ApplicationController end private - def send_message user_id, project_id, title - self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id, :title => title) + def send_message user_id, project_id, pull_request_id + self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id, + :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true) end def authorize_logged diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 54eea89c0..95a079714 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -194,24 +194,31 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> - + <% end %> <% end %> \ No newline at end of file From 2cee4448ea30f129e09d632864b680f92cf78b93 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 29 Nov 2016 18:19:29 +0800 Subject: [PATCH 02/31] =?UTF-8?q?pullrequest=E6=B6=88=E6=81=AF=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 14 ++++++++++++++ app/views/users/_user_message_forge.html.erb | 10 +++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 4dd3399a3..14064c11f 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -90,6 +90,20 @@ module UsersHelper end end + # 获取pullrequest消息状态 + def pull_request_message_status ma + case ma.status + when 1 + "创建了PullRequest:" + when 2 + "接受了您的PullRequest:" + when 3 + "重新打开了PullRequest:" + when 4 + "关闭了您的PullRequest:" + end + + end # 判断当前用户能否对消息进行操作 def allow_to_show applied_message (User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 95a079714..c28c40065 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -206,16 +206,12 @@ <%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> - <% if ma.status == 1 %> - 创建了PullRequest: - <% elsif ma.status == 3 %> - 重新打开了PullRequest: - <% end %> + <%= pull_request_message_status(ma) %>
  • - <%= link_to "#{ma.forge_message.forge_message_id.title}", - {:controller => 'pull_requests', :action => 'show', :id => ma.forge_message.project_id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> + <%= link_to "#{ma.forge_message.forge_message_id.title}", {:controller => 'pull_requests', :action => 'show', :id => ma.forge_message.project_id }, + :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
  • <%= time_tag(ma.created_at).html_safe %>
  • From 9fa4b5613a7053b1ae7b01949c6832e6946e39d2 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 30 Nov 2016 08:37:56 +0800 Subject: [PATCH 03/31] =?UTF-8?q?pullrequest=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index d3d60bf5a..9cb2d2c02 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -296,7 +296,7 @@ class PullRequestsController < ApplicationController private def send_message user_id, project_id, pull_request_id - self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id, + ForgeMessage.create(:user_id => user_id, :project_id => project_id, :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true) end From 2e5cd96bb9b85046aec8dc44cf993d6979c932dd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Dec 2016 11:31:48 +0800 Subject: [PATCH 04/31] =?UTF-8?q?pullrequest=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 56 ++++++++++++++++--- app/helpers/users_helper.rb | 4 +- app/models/pull_request.rb | 2 +- app/views/repositories/show.html.erb | 20 +++---- app/views/users/_user_message_course.html.erb | 8 +-- app/views/users/_user_message_forge.html.erb | 16 +++--- ...61129032534_add_status_to_pull_requests.rb | 5 -- ...0161130031415_add_titil_to_pull_requsts.rb | 5 ++ 8 files changed, 80 insertions(+), 36 deletions(-) delete mode 100644 db/migrate/20161129032534_add_status_to_pull_requests.rb create mode 100644 db/migrate/20161130031415_add_titil_to_pull_requsts.rb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 9cb2d2c02..7da5a0dc1 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -97,16 +97,31 @@ class PullRequestsController < ApplicationController request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id) @fork_project_name = Project.find(params[:target_project_id]).try(:name) @fork_pr_message = true if @fork_project_name - # 发送消息 - send_message(User.current.id, target_project_id, request.id) + # fork项目的pullrequest发送消息 + # 向管理员发送消息 + @project_member = Member.where(:project_id => params[:target_project_id].to_i) + unless @project_member.nil? + @project_member.each do |mem| + if is_project_manager?(mem.user_id, params[:target_project_id].to_i) && mem.user_id != User.current.id + send_message(mem.user_id, params[:target_project_id].to_i, request.id, 1) + end + end + end # 创建Trustie数据 - PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id) + PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id, :title => title) else + @project_member = Member.where(:project_id => @project.id) request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch) # 发送消息 - send_message(User.current.id, @project.id, request.id) + unless @project_member.nil? + @project_member.each do |mem| + if is_project_manager?(mem.user_id, @project.id) && mem.user_id != User.current.id + send_message(mem.user_id, @project.id, request.id, 1) + end + end + end # 创建Trustie数据 - PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id) + PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id, :title => title) respond_to do |format| format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)} end @@ -180,6 +195,14 @@ class PullRequestsController < ApplicationController begin status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid) PullRequest.create(:pull_request_id => status.id, :user_id => User.current.id, :gpid => status.project_id) + + # 接受后,给用户发消息 + request = @g.merge_request(@project.gpid, params[:id]) + if User.current.login != request.author.try(:username) + message_user = User.where( :login => request.author.try(:username) ).first + send_message(message_user.id, @project.id, request.id, 2) + end + respond_to do |format| format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)} end @@ -205,6 +228,25 @@ class PullRequestsController < ApplicationController def update_pull_request begin @g.update_merge_request(@project.gpid, params[:id], User.current.gid, :state_event => params[:state]) + + # 自己关闭/重新打开 就给每个管理员发送消息,如果是管理员关闭/重新打开,就给用户发消息 + request = @g.merge_request(@project.gpid, params[:id]) + @project_member = Member.where(:project_id => @project.id) + # 发送消息 + if ( params[:state] == "close" || params[:state] == "reopen" ) && User.current.login == request.author.try(:username) + unless @project_member.nil? + @project_member.each do |mem| + if is_project_manager?(mem.user_id, @project.id) && mem.user_id != User.current.id + send_message(mem.user_id, @project.id, request.id, params[:state] == "close" ? 4 : 3) + end + end + end + end + if ( params[:state] == "close" || params[:state] == "reopen" ) && User.current.login != request.author.try(:username) + message_user = User.where( :login => request.author.try(:username) ).first + send_message(message_user.id, @project.id, request.id, params[:state] == "close" ? 4 : 3) + end + respond_to do |format| format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)} end @@ -295,9 +337,9 @@ class PullRequestsController < ApplicationController end private - def send_message user_id, project_id, pull_request_id + def send_message user_id, project_id, pull_request_id, status ForgeMessage.create(:user_id => user_id, :project_id => project_id, - :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true) + :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true, :status => status) end def authorize_logged diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 14064c11f..98024954d 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -96,11 +96,11 @@ module UsersHelper when 1 "创建了PullRequest:" when 2 - "接受了您的PullRequest:" + "接受了PullRequest:" when 3 "重新打开了PullRequest:" when 4 - "关闭了您的PullRequest:" + "关闭了PullRequest:" end end diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index ec13ff16b..92f9b56a6 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -1,6 +1,6 @@ class PullRequest < ActiveRecord::Base # status 1:创建 2:接受 3:重新打开 4:关闭 - attr_accessible :gpid, :pull_request_id, :user_id, :status + attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title validates_uniqueness_of :pull_request_id has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 282df48c3..05b8d40d0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -27,17 +27,17 @@ <% unless @entries.nil? %> ZIP下载 - <% if User.current.member_of?(@project) && @project.is_public? %> - <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> - <% else %> - <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> - <% end %> - <% end %> - <% end %> - <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> - <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <%# if User.current.member_of?(@project) && @project.is_public? %> + <%# if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%#= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> + <%# else %> + <%#= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> + <%# end %> + <%# end %> <% end %> + <%# unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%#= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <%# end %>
    <%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index b1936e19b..f43b87360 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -304,7 +304,7 @@
  • - <%=link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">发布了问卷:
  • @@ -327,7 +327,7 @@
  • - <%=link_to User.find(ma.course_message.author).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %>
  • <% if ma.course_message.parent_id.nil? %> @@ -423,7 +423,7 @@
  • - <%= link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%= link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">在班级中留言了:
  • @@ -447,7 +447,7 @@
  • - <%= link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%= link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <% if ma.course_message.m_parent_id.nil? %> 回复了您的作业: diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index c28c40065..b32e7bcb4 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -162,7 +162,7 @@ <% if ma.forge_message_type == "Message" %> <% end %> - <% if ma.forge_message_type == "PullRequest" && is_project_manager?( User.current.id, ma.forge_message.project_id) %> + <% if ma.forge_message_type == "PullRequest" %>
    • - <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %> + <% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %> + <% author = User.find(send_message_user[0].user_id) %> + <%= link_to image_tag(url_to_avatar(author), :width => "30", :height => "30"), user_path(author), :target => '_blank' %>
    • - <%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author), - :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%= link_to User.find(send_message_user[0].user_id).show_name, user_path(send_message_user[0].user_id), + :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <%= pull_request_message_status(ma) %>
    • - <%= link_to "#{ma.forge_message.forge_message_id.title}", {:controller => 'pull_requests', :action => 'show', :id => ma.forge_message.project_id }, + <%= link_to "#{send_message_user[0].title}", project_pull_requests_path(ma.project_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
    • diff --git a/db/migrate/20161129032534_add_status_to_pull_requests.rb b/db/migrate/20161129032534_add_status_to_pull_requests.rb deleted file mode 100644 index a8ad71125..000000000 --- a/db/migrate/20161129032534_add_status_to_pull_requests.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToPullRequests < ActiveRecord::Migration - def change - add_column :pull_requests, :status, :integer, :default => false - end -end diff --git a/db/migrate/20161130031415_add_titil_to_pull_requsts.rb b/db/migrate/20161130031415_add_titil_to_pull_requsts.rb new file mode 100644 index 000000000..cc3ce3fef --- /dev/null +++ b/db/migrate/20161130031415_add_titil_to_pull_requsts.rb @@ -0,0 +1,5 @@ +class AddTitilToPullRequsts < ActiveRecord::Migration + def change + add_column :pull_requests, :title, :string + end +end From 233ce0428b33d9085139d9cb83e7b225bfa92062 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Dec 2016 13:55:15 +0800 Subject: [PATCH 05/31] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index f43b87360..49e78521c 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -7,7 +7,7 @@
    • - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to ma.course_message.author.show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">发布了通知:
    • From c745f69e95d83f457bd3c1b57d8deff51124c638 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Dec 2016 15:44:15 +0800 Subject: [PATCH 06/31] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8Cfork=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E3=80=82=E5=B9=B6=E4=BF=AE=E6=94=B9=E5=B0=8F=E9=93=83?= =?UTF-8?q?=E9=93=9B=E6=B6=88=E6=81=AF=E7=9A=84=E7=8F=AD=E7=BA=A7=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E7=94=B3=E8=AF=B7=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 8 ++++---- app/views/issues/_statistics.html.erb | 2 +- app/views/projects/member_forked.html.erb | 5 ++++- app/views/projects/project_watcherlist.html.erb | 4 ++++ app/views/users/_join_course_course_message.html.erb | 6 +++--- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b9d61e61e..dcd337df2 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -543,12 +543,12 @@ class ProjectsController < ApplicationController @users -= watched.watcher_users if @watched end @watchers = @project.watcher_users - @limit = 20 + @limit = 32 @is_remote = true @watchers_count = @watchers.count @watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1 @offset ||= @watcher_pages.offset - @watchers = paginateHelper @watchers, 20 + @watchers = paginateHelper @watchers, @limit end end @@ -611,14 +611,14 @@ class ProjectsController < ApplicationController @applied_members = appied_project_members(@project, @members) end end - @members = paginateHelper @members + @members = paginateHelper @members, 32 end def member_forked @forked_projects = Project.where(:forked_from_project_id => @project.id) - @limit = 20 + @limit = 32 @is_remote = true @forked_count = @forked_projects.count @forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1 diff --git a/app/views/issues/_statistics.html.erb b/app/views/issues/_statistics.html.erb index 8b1fc6f22..d284aabb4 100644 --- a/app/views/issues/_statistics.html.erb +++ b/app/views/issues/_statistics.html.erb @@ -4,7 +4,7 @@
  • -
      +
      • <%= link_to "所有#{@issues_filter.count}".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %>
      • diff --git a/app/views/projects/member_forked.html.erb b/app/views/projects/member_forked.html.erb index 668feef98..b3cfad1d4 100644 --- a/app/views/projects/member_forked.html.erb +++ b/app/views/projects/member_forked.html.erb @@ -1,3 +1,4 @@ +<% if @forked_count > 0 %>

        成员本页面展示Fork了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户

          @@ -24,4 +25,6 @@
    - +<% else %> + <%= render :partial => "projects/no_data" %> +<% end %> diff --git a/app/views/projects/project_watcherlist.html.erb b/app/views/projects/project_watcherlist.html.erb index 440975e68..c421f4f81 100644 --- a/app/views/projects/project_watcherlist.html.erb +++ b/app/views/projects/project_watcherlist.html.erb @@ -1,3 +1,4 @@ +<% if @watchers.count > 0 %>

    成员 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户

      @@ -24,6 +25,9 @@
    +<% else %> + <%= render :partial => "projects/no_data" %> +<% end %> diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb index c69d66ad0..eacbfac8c 100644 --- a/app/views/users/_join_course_course_message.html.erb +++ b/app/views/users/_join_course_course_message.html.erb @@ -1,11 +1,11 @@
  • 系统提示 - ">您有了新的课程成员申请: + ">您有了新的班级成员申请:
  • - <% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "教辅"}" %> + <% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "助教"}" %> <%= link_to content, user_path(User.find(ma.course_message_id), :course_id => ma.course_id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank', :title => "#{content}" %> @@ -14,7 +14,7 @@
  • + <% if @tip_all_attachments > 0 %>

    <%= render :partial => "files/tip_attachment_count" %> @@ -124,5 +125,8 @@

    <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
    + <% else %> + <%= render :partial => "projects/no_data" %> + <% end %>
    <%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index a9f70f999..aa51842aa 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -214,6 +214,9 @@
    新建 + <% if @issues.empty? %> + <%= render :partial => "projects/no_data" %> + <% else %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'xls', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %> @@ -236,7 +239,6 @@ <%= calendar_for('issue_create_date_start_show')%> -
    <% end %> <% end %> -<% if @issues.empty? %> -

    <%= l(:label_no_data) %>

    -<% else %> +
    <%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
    diff --git a/app/views/projects/_no_data.html.erb b/app/views/projects/_no_data.html.erb index 249a67af0..bc8b97547 100644 --- a/app/views/projects/_no_data.html.erb +++ b/app/views/projects/_no_data.html.erb @@ -1,4 +1,4 @@ -
    +

    没有数据可供显示!

    \ No newline at end of file diff --git a/app/views/projects/member_forked.html.erb b/app/views/projects/member_forked.html.erb index b3cfad1d4..d5dba7ae2 100644 --- a/app/views/projects/member_forked.html.erb +++ b/app/views/projects/member_forked.html.erb @@ -26,5 +26,7 @@
    <% else %> +
    <%= render :partial => "projects/no_data" %> +
    <% end %> diff --git a/app/views/projects/project_watcherlist.html.erb b/app/views/projects/project_watcherlist.html.erb index c421f4f81..1c97e2855 100644 --- a/app/views/projects/project_watcherlist.html.erb +++ b/app/views/projects/project_watcherlist.html.erb @@ -26,7 +26,9 @@
    <% else %> +
    <%= render :partial => "projects/no_data" %> +
    <% end %> diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index f2591b6ea..4053e6739 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -62,6 +62,8 @@ <% else %> +
    <%= render :partial => "projects/no_data" %> +
    <% end %> diff --git a/app/views/users/_project_boardlist.html.erb b/app/views/users/_project_boardlist.html.erb index dbc0b3992..c18b003d2 100644 --- a/app/views/users/_project_boardlist.html.erb +++ b/app/views/users/_project_boardlist.html.erb @@ -2,6 +2,7 @@

    讨论区列表

    + <% if topics.any? %>
    排序: <%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %> @@ -15,7 +16,6 @@
    - <% if topics.any? %> <% topics.each do |activity| %>
    @@ -59,11 +59,11 @@
    - <% else %> -

    <%= l(:label_no_data) %>

    - <% end %>
    + <% else %> + <%= render :partial => "projects/no_data" %> + <% end %>
    -
    +
    <%= render :partial => 'poll_list'%>
    \ No newline at end of file diff --git a/app/views/poll/publish_poll.js.erb b/app/views/poll/publish_poll.js.erb index 91dcdc882..6e24cbc0a 100644 --- a/app/views/poll/publish_poll.js.erb +++ b/app/views/poll/publish_poll.js.erb @@ -1,4 +1,4 @@ -$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); showModal('ajax-modal', '250px'); //$('#ajax-modal').css('height','111px'); diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb index 1d025a5b2..27169a413 100644 --- a/app/views/poll/republish_poll.js.erb +++ b/app/views/poll/republish_poll.js.erb @@ -1,4 +1,4 @@ -$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); showModal('ajax-modal', '250px'); //$('#ajax-modal').css('height','80px'); diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index aeb817e76..931aeb39e 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -183,6 +183,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mw380 {max-width: 380px !important;} .mw400 {max-width: 400px !important;} .mw450 {max-width: 450px !important;} +.mw550 {max-width: 550px !important;} .mt-20 {margin-top:-20px;} .mt-10 {margin-top:-10px;} .mt-4 {margin-top:-4px;} diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index 91a22a177..97ba3801f 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -594,9 +594,9 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .exercise_status_end{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -659px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;} .exercise_status_com{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -681px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;} .exercise_status_nocom{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -705px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;} -a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;} +a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:25px; display:block;float:right;} a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;} -.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;} +.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:25px; display:block;float:right; margin-right:10px;} a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;} /*首页课程列表归档按钮提示*/ diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index 085acd80f..2ceb11f20 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -15,7 +15,7 @@ a.newbtn{ float:right; display:block; width:80px; height:27px; padding-top:3px; a:hover.newbtn{ background:#55a1b9; text-decoration:none;} .polls_list_ul{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:32px; padding-top:8px;} a.polls_title{ font-weight:bold; color:#3e6d8e; margin-top:3px;} -a.pollsbtn{ display:block; width:66px; height:20px; padding-top:2px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;} +a.pollsbtn{ display:block; height:20px; padding:0 9px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;} a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} .polls_date{ color:#666666;margin-top:3px; } .polls_de{ color:#6883b6; margin-top:3px;} @@ -129,7 +129,7 @@ a.btn_de{ border:1px solid #ff5d31; color:#ff5d31; } a:hover.btn_de{ background:#ff5d31;} a.btn_pu{ border:1px solid #3cb761; color:#3cb761; } a:hover.btn_pu{ background:#3cb761;} -.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; } +.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:20px;} .polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_title_st { max-width:450px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_de_grey{ color:#b1b1b1; margin-top:3px;} From b48fc7ba3b979e071f1e5e001793005de6f7c566 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 2 Dec 2016 16:18:31 +0800 Subject: [PATCH 19/31] =?UTF-8?q?pullrequest=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 10 ++++++---- app/models/forge_message.rb | 2 +- app/views/repositories/show.html.erb | 20 +++++++++---------- app/views/users/_user_message_forge.html.erb | 4 ++-- ...02073523_add_aperate_idto_forge_message.rb | 5 +++++ 5 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20161202073523_add_aperate_idto_forge_message.rb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index b68db3563..6f245a92b 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -190,7 +190,7 @@ class PullRequestsController < ApplicationController begin status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid) # 接受后,给用户发消息 - send_message_to_author(@project.id, status.author.try(:user_name), params[:id], 2) + send_message_to_author(@project.id, status.author.try(:username), params[:id], 2) respond_to do |format| format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)} @@ -220,8 +220,8 @@ class PullRequestsController < ApplicationController user = User.find_by_login(request.author.try(:username)) status = params[:state] == "close" ? 4 : 3 send_message_to_manager(@project.id, params[:id], status) - if !is_project_manager?(user.id, @project.id) - send_message_to_author(@project, user.login, request.id, status) + if is_project_manager?(User.current.id, @project.id) + send_message_to_author(@project.id, user.login, request.id, status) end respond_to do |format| format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)} @@ -350,7 +350,9 @@ class PullRequestsController < ApplicationController :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true, - :status => status) + :status => status, + :operate_user_id => User.current.id, + ) end def authorize_logged diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb index bc514025e..e131eb600 100644 --- a/app/models/forge_message.rb +++ b/app/models/forge_message.rb @@ -1,7 +1,7 @@ class ForgeMessage < ActiveRecord::Base # status在不同的类中,作用不同 # Isseu: satus nil:发布了缺陷;:1:缺陷计划完成日志到了提醒 - attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status + attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status, :operate_user_id belongs_to :forge_message ,:polymorphic => true belongs_to :project diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 282df48c3..05b8d40d0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -27,17 +27,17 @@ <% unless @entries.nil? %> ZIP下载 - <% if User.current.member_of?(@project) && @project.is_public? %> - <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> - <% else %> - <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> - <% end %> - <% end %> - <% end %> - <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> - <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <%# if User.current.member_of?(@project) && @project.is_public? %> + <%# if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%#= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> + <%# else %> + <%#= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> + <%# end %> + <%# end %> <% end %> + <%# unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%#= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <%# end %>
    <%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %> diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 5204a9bff..10a14ffa9 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -200,12 +200,12 @@
  • <% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %> - <% author = User.find(send_message_user[0].user_id) %> + <% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %> <%= link_to image_tag(url_to_avatar(author), :width => "30", :height => "30"), user_path(author), :target => '_blank' %>
  • - <%= link_to User.find(send_message_user[0].user_id).show_name, user_path(send_message_user[0].user_id), + <%= link_to User.find(author.id).show_name, user_path(author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <%= pull_request_message_status(ma) %> diff --git a/db/migrate/20161202073523_add_aperate_idto_forge_message.rb b/db/migrate/20161202073523_add_aperate_idto_forge_message.rb new file mode 100644 index 000000000..c58fb5afd --- /dev/null +++ b/db/migrate/20161202073523_add_aperate_idto_forge_message.rb @@ -0,0 +1,5 @@ +class AddAperateIdtoForgeMessage < ActiveRecord::Migration + def change + add_column :forge_messages, :operate_user_id, :integer + end +end From 56b6d4386261c63fb84616bf9b1b310f79def313 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Dec 2016 17:08:09 +0800 Subject: [PATCH 20/31] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=97=B6=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E4=BA=BA=E7=9A=84=E8=AF=84=E5=88=86=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 7 ++++++- app/views/student_work/_jour_replay.html.erb | 2 +- app/views/student_work/_student_work_score.html.erb | 8 +++++--- app/views/student_work/add_score.js.erb | 7 ++++--- app/views/student_work/add_score_reply.js.erb | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 0c6b42ca5..7119d7c9f 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -691,7 +691,11 @@ class StudentWorkController < ApplicationController def show @score = student_work_score @work,User.current @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @student_work_scores = student_work_score_record(@work) + if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current + @student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc") + else + @student_work_scores = student_work_score_record(@work) + end respond_to do |format| format.js end @@ -867,6 +871,7 @@ class StudentWorkController < ApplicationController @score = StudentWorksScore.find params[:score_id] @is_last = params[:is_last] == "true" @jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0) + @show_real_name = User.current.allowed_to?(:as_teacher, @score.student_work.homework_common.course) || User.current.admin? || @score.reviewer_role != 3 || @jour.user == User.current if @jour.save @status = 1 else diff --git a/app/views/student_work/_jour_replay.html.erb b/app/views/student_work/_jour_replay.html.erb index 4b594d7f4..eba5b2c08 100644 --- a/app/views/student_work/_jour_replay.html.erb +++ b/app/views/student_work/_jour_replay.html.erb @@ -2,7 +2,7 @@ <%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
    - <%= link_to jour.user.show_name, user_path(jour.user), :title => jour.user.show_name, :class => "c_blue fl" %> + <%= link_to show_real_name ? jour.user.show_name : "匿名", user_path(jour.user), :title => jour.user.show_name, :class => "c_blue fl" %> <% if jour.user==User.current || User.current.admin? %> <%= link_to(l(:label_bid_respond_delete), destroy_score_reply_student_work_index_path(:jour_id => jour.id), diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb index 3730c99fb..e7c201736 100644 --- a/app/views/student_work/_student_work_score.html.erb +++ b/app/views/student_work/_student_work_score.html.erb @@ -1,6 +1,7 @@
      - <% show_real_name = @is_teacher || score.user == User.current || score.user.allowed_to?(:as_teacher,@course) || score.reviewer_role != 3 %> + <% show_real_name = @is_teacher || score.user == User.current || score.reviewer_role != 3 %> <%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %> + <% show_real_score = @homework.score_open == 1 || @is_teacher || score.student_work.user == User.current %>
      <%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "linkBlue fl" %> @@ -9,7 +10,7 @@ <% unless score.score.nil? %> 评分: - <%= score.score%>分 + <%= show_real_score ? score.score : "**" %>分 <% end %> 回复 @@ -33,7 +34,8 @@
      <% score.journals_for_messages.order("created_on desc").each do |jour|%> - <%= render :partial => 'jour_replay',:locals => {:jour => jour}%> + <% show_real_name = @is_teacher || score.reviewer_role != 3 %> + <%= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => show_real_name || jour.user == User.current}%> <% end%>
      diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 03693bff4..9c974a57f 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -7,6 +7,7 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'}); <%# else %> //$("#work_score_<%#= @score.id%>").html("<%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>"); <%# end%> +<% score_open = @is_teacher || @homework.score_open == 1 || @work.user == User.current %> $("#score_list_<%= @work.id%>").html("<%=escape_javascript(render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => is_member_work}) %>"); var num = $("#work_num_<%= @work.id%>").html(); @@ -19,14 +20,14 @@ $("#score_list_<%= @work.id%>").removeAttr("style"); $("#group_member_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'group_member_work', :locals => {:student_work => @work}) %>"); <% else %> <% anon_count = @work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %> - $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_member_work', :locals => {:st => @work, :anon_count => anon_count}) %>"); + $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_member_work', :locals => {:st => @work, :anon_count => anon_count, :score_open => score_open}) %>"); <% end %> <% else %> - $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>"); + $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>"); $("#work_num_<%= @work.id%>").html(num); <% end %> <% else %> - $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>"); + $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>"); $("#work_num_<%= @work.id%>").html(num); <% end%> diff --git a/app/views/student_work/add_score_reply.js.erb b/app/views/student_work/add_score_reply.js.erb index f21870cd5..e4c5f26e9 100644 --- a/app/views/student_work/add_score_reply.js.erb +++ b/app/views/student_work/add_score_reply.js.erb @@ -1,6 +1,6 @@ $("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score,:is_last => @is_last}) %>"); <% if @status && @status == 1%> - $("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>"); + $("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour, :show_real_name => @show_real_name}) %>"); $("#add_score_reply_<%= @score.id%>").hide(); <% else%> alert("回复内容不能为空"); From 28444e0af7bfbef34c03a5345559dfbbbc6d183d Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Dec 2016 17:46:31 +0800 Subject: [PATCH 21/31] =?UTF-8?q?=E2=80=9C=E6=9C=AA=E8=AF=84=E5=88=86?= =?UTF-8?q?=E2=80=9D=E6=94=B9=E4=B8=BA=E2=80=9C=E6=97=A0=E8=AF=84=E5=88=86?= =?UTF-8?q?=E2=80=9D=EF=BC=8C=20=E8=AF=84=E5=88=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E8=AF=84=E6=89=A3=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- app/views/homework_common/_set_score_rule_non_pro.html.erb | 4 ++-- app/views/homework_common/_set_score_rule_pro.html.erb | 4 ++-- .../student_work/_evaluation_un_group_member_work.html.erb | 2 +- app/views/student_work/_evaluation_un_work.html.erb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 7119d7c9f..596775045 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -987,7 +987,7 @@ class StudentWorkController < ApplicationController end end - no_anon_penalty = params[:no_anon_penalty] ? 1 : 0 + no_anon_penalty = params[:no_anon_penalty] ? 0 : 1 if no_anon_penalty != homework_detail_manual.no_anon_penalty homework_detail_manual.no_anon_penalty = no_anon_penalty if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 diff --git a/app/views/homework_common/_set_score_rule_non_pro.html.erb b/app/views/homework_common/_set_score_rule_non_pro.html.erb index 98f995a60..6afd5f1ee 100644 --- a/app/views/homework_common/_set_score_rule_non_pro.html.erb +++ b/app/views/homework_common/_set_score_rule_non_pro.html.erb @@ -17,8 +17,8 @@
    • - value="<%=homework.homework_detail_manual.no_anon_penalty%>"/> - + value="<%=homework.homework_detail_manual.no_anon_penalty%>"/> +
    • diff --git a/app/views/homework_common/_set_score_rule_pro.html.erb b/app/views/homework_common/_set_score_rule_pro.html.erb index f21c4d614..0a2c01b6f 100644 --- a/app/views/homework_common/_set_score_rule_pro.html.erb +++ b/app/views/homework_common/_set_score_rule_pro.html.erb @@ -17,8 +17,8 @@
    • - value="<%=homework.homework_detail_manual.no_anon_penalty%>"/> - + value="<%=homework.homework_detail_manual.no_anon_penalty%>"/> +
    • diff --git a/app/views/student_work/_evaluation_un_group_member_work.html.erb b/app/views/student_work/_evaluation_un_group_member_work.html.erb index 257f1070c..d98e1b6a8 100644 --- a/app/views/student_work/_evaluation_un_group_member_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_member_work.html.erb @@ -48,7 +48,7 @@ <% elsif @homework.homework_detail_manual.comment_status == 2 && work.student_works_evaluation_distributions.count != 0 %> 待匿评 <% elsif @homework.homework_detail_manual.comment_status == 3 && work.student_works_evaluation_distributions.count != 0 %> - 未评分 + 无评分 <% else %> 迟交 <% end %> diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index ef3f670af..304625702 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -79,7 +79,7 @@ <% elsif @homework.homework_detail_manual.comment_status == 2 && student_work.student_works_evaluation_distributions.count != 0 %> 待匿评 <% elsif @homework.homework_detail_manual.comment_status == 3 && student_work.student_works_evaluation_distributions.count != 0 %> - 未评分 + 无评分 <% end %> <% else %> -- From e4e57380cf3de42909bd7cf040b283a6b108174e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 2 Dec 2016 17:52:02 +0800 Subject: [PATCH 22/31] =?UTF-8?q?pull=20request=E6=8F=90=E4=BA=A4=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/pull_requests/_pull_request_commits.html.erb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/views/pull_requests/_pull_request_commits.html.erb b/app/views/pull_requests/_pull_request_commits.html.erb index 79db43a83..8691fcea9 100644 --- a/app/views/pull_requests/_pull_request_commits.html.erb +++ b/app/views/pull_requests/_pull_request_commits.html.erb @@ -16,6 +16,15 @@
    <% end %> +
    +
    +
      + <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %> +
    +
    +
    +
    +
    From cad06701be14de57ef7384ff4d49134b4d3df72b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Dec 2016 19:07:06 +0800 Subject: [PATCH 23/31] =?UTF-8?q?=E9=9D=9E=E5=8C=BF=E8=AF=84=E9=98=B6?= =?UTF-8?q?=E6=AE=B5=E5=BA=94=E7=9C=8B=E5=88=B0=E8=AF=84=E8=AF=AD=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_student_work_score.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb index e7c201736..a8facff30 100644 --- a/app/views/student_work/_student_work_score.html.erb +++ b/app/views/student_work/_student_work_score.html.erb @@ -34,7 +34,7 @@
    <% score.journals_for_messages.order("created_on desc").each do |jour|%> - <% show_real_name = @is_teacher || score.reviewer_role != 3 %> + <% show_real_name = @is_teacher || score.reviewer_role != 3 || @homework.homework_detail_manual.comment_status != 2 %> <%= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => show_real_name || jour.user == User.current}%> <% end%>
    From 585d1ebb0d5f842c5c31789bdbdadd118c43d505 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 2 Dec 2016 19:14:09 +0800 Subject: [PATCH 24/31] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=EF=BC=8C=E5=B0=86=E8=AF=BE=E7=A8=8B=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 20 +++++++++---------- .../_join_course_course_message.html.erb | 9 +++++---- app/views/users/user_organizations.html.erb | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 05b8d40d0..282df48c3 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -27,17 +27,17 @@ <% unless @entries.nil? %> ZIP下载 - <%# if User.current.member_of?(@project) && @project.is_public? %> - <%# if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%#= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> - <%# else %> - <%#= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> - <%# end %> - <%# end %> + <% if User.current.member_of?(@project) && @project.is_public? %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> + <% else %> + <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> + <% end %> + <% end %> + <% end %> + <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> <% end %> - <%# unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> - <%#= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> - <%# end %>
    <%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %> diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb index eacbfac8c..78a6f2ecd 100644 --- a/app/views/users/_join_course_course_message.html.erb +++ b/app/views/users/_join_course_course_message.html.erb @@ -5,7 +5,7 @@
  • - <% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "助教"}" %> + <% content = User.find(ma.course_message_id).name+"申请成为班级\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "助教"}" %> <%= link_to content, user_path(User.find(ma.course_message_id), :course_id => ma.course_id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank', :title => "#{content}" %> @@ -17,9 +17,10 @@ <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的班级成员申请,信息如下:

    真实姓名:<%= User.find(ma.course_message_id).realname %>

    -

    申请课程:<%= Course.find(ma.course_id).name%>

    -
    课程描述:
    -
    <%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %>

    申请职位:<%=ma.content && ma.content.include?('9') ? "教师" : "教辅"%>

    +

    申请班级:<%= Course.find(ma.course_id).name%>

    +
    班级描述:
    +
    <%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %>
    +

    申请职位:<%=ma.content && ma.content.include?('9') ? "教师" : "助教"%>

  • diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index 7e4b28393..6f1b7db2f 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -3,7 +3,7 @@
    -
    s +
    组织列表 新建组织 <%#= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> From 7baa5be7eefeffa4b375fb961fc7733d96913f15 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 2 Dec 2016 20:00:15 +0800 Subject: [PATCH 25/31] =?UTF-8?q?pull=20request=E6=80=BB=E6=95=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 4 ++-- app/views/pull_requests/_pull_requests_list.html.erb | 11 ++++++++++- app/views/pull_requests/index.html.erb | 10 ---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 6f245a92b..b6fdd1fee 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -38,12 +38,12 @@ class PullRequestsController < ApplicationController @requests_merged_count = merge_requests.select{|request| request.state == "merged"}.count @requests_closed_count = merge_requests.select{|request| request.state == "closed"}.count - @limit = 10 + @limit = 20 @is_remote = true @count = type_count(type, @requests_opened_count, @requests_merged_count, @requests_closed_count) @pages = Paginator.new @count, @limit, params['page'] || 1 @offset ||= @pages.offset - @requests = paginateHelper @requests, 10 + @requests = paginateHelper @requests, 20 respond_to do |format| format.html format.js diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb index c594a2e56..9600cb135 100644 --- a/app/views/pull_requests/_pull_requests_list.html.erb +++ b/app/views/pull_requests/_pull_requests_list.html.erb @@ -14,8 +14,17 @@

    由 <%= link_to get_user_by_login_and(request.author.try(:username)).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) %>前更新 -

    <%= find_gitlab_project(request.source_project_id)+"/"+request.source_branch %>合并到<%= find_gitlab_project(request.target_project_id)+"/"+request.target_branch %>

    +

    <%#= find_gitlab_project(request.source_project_id)+"/"+request.source_branch %>合并到<%#= find_gitlab_project(request.target_project_id)+"/"+request.target_branch %>

    <% end %> +
    +
    +
      + <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => true, :flag => true, :is_new => true%> +
    +
    +
    +
    +
    <% end %> \ No newline at end of file diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index 4053e6739..749135a15 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -28,16 +28,6 @@
    <%= render "pull_requests/pull_requests_list" %> - -
    -
    -
      - <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> -
    -
    -
    -
    -