From f5a2d6acdb4e23e4e8d21c9591303f4038ea8ba5 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 5 Aug 2016 17:33:31 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E5=93=81?= =?UTF-8?q?=EF=BC=9A=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E4=BD=9C=E5=93=81=E6=A0=A1=E9=AA=8C=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E9=87=8D=E8=AF=95=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E4=B8=AD=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E4=BD=9C=E5=93=81=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=B0=B1=E6=B2=A1=E6=9C=89=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 34 ++++++++++++---------- app/models/student_work.rb | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 3d87b007d..6ea8baa29 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -775,23 +775,27 @@ class StudentWorkController < ApplicationController end def retry_work - if @work.destroy - if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 - pros = @work.student_work_projects.where("is_leader = 0") - pros.each do |pro| - pro.destroy - end - project = @work.student_work_projects.where("is_leader = 1").first - project.update_attributes(:student_work_id => nil) - elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 - @work.student_work_projects.each do |pro2| - pro2.destroy + if @homework.homework_type == 3 + if @work.destroy + if @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end end end - @student_work = StudentWork.new - respond_to do |format| - format.js - end + elsif @homework.homework_type == 1 + @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0) + end + @student_work = StudentWork.new + respond_to do |format| + format.js end end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 3fcc9fb8a..3ba3ee2b2 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -1,6 +1,6 @@ #学生提交作品表 class StudentWork < ActiveRecord::Base - attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value + attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status belongs_to :homework_common belongs_to :user From 7c484b4f4a2f29a38ba98eae96eafc60b2254157 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Aug 2016 18:00:10 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/pull_requests/_show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index c46ebddb9..be3970d3a 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -17,7 +17,7 @@

请将新改动提交至源分支或者切换到其它目标分支

<% else %> <% if @request.state == "merged" %> - Hjqreturn于两小时前合并
+ <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %> 前合并

改动已合并至<%= @request.target_branch %>

<% else %> <% if is_project_manager?(User.current.id, @project.id) %> From cd30f94d72a2d4df6b7f34d4d656006d37ffebc8 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 5 Aug 2016 18:01:11 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=BC=B9=E6=A1=86=E4=BD=8D=E7=BD=AE=E5=8F=8A?= =?UTF-8?q?=E5=8F=AF=E6=8B=96=E6=8B=BDjs=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/choose_user_course.js.erb | 2 +- app/views/users/send_homework_to_course.js.erb | 2 +- app/views/users/show_homework_detail.js.erb | 2 +- public/javascripts/application.js | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/views/users/choose_user_course.js.erb b/app/views/users/choose_user_course.js.erb index 512a66018..19a244396 100644 --- a/app/views/users/choose_user_course.js.erb +++ b/app/views/users/choose_user_course.js.erb @@ -8,7 +8,7 @@ <%# else %> <% if params[:is_observe].nil? %> var htmlvalue = "<%= escape_javascript(render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>"; - pop_box_new(htmlvalue,460,50,50); + pop_box_new(htmlvalue,460,435); <% else %> $("#send_homework_to_course_form").html("<%= escape_javascript(render :partial => 'users/send_homework_to_course_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>"); <% end %> diff --git a/app/views/users/send_homework_to_course.js.erb b/app/views/users/send_homework_to_course.js.erb index 7db28b869..2541c5bc7 100644 --- a/app/views/users/send_homework_to_course.js.erb +++ b/app/views/users/send_homework_to_course.js.erb @@ -1,4 +1,4 @@ $("#subject_count_homework_<%=@homework.id %>").html(<%= @homework.quotes %>); hideModal(); var htmlvalue = "<%= escape_javascript(render :partial => 'homework_post_notice') %>"; -pop_box_new(htmlvalue,380,40,50); \ No newline at end of file +pop_box_new(htmlvalue,380,182); \ No newline at end of file diff --git a/app/views/users/show_homework_detail.js.erb b/app/views/users/show_homework_detail.js.erb index 8c0e3c54a..cbb0cf057 100644 --- a/app/views/users/show_homework_detail.js.erb +++ b/app/views/users/show_homework_detail.js.erb @@ -3,5 +3,5 @@ $("#choose_courses_notice").html(""); <% else %> var htmlvalue = "<%= escape_javascript(render :partial => 'users/homework_repository_detail') %>"; - pop_box_new(htmlvalue,820,50,50); + pop_box_new(htmlvalue,820,155); <% end %> \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 20040f559..cfeb4b341 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1495,7 +1495,7 @@ function pop_up_box(value,tWidth,tTop,tLeft){ // 公共弹框样式 function pop_box_new(value, Width, Height){ w = ($(window).width() - Width)/2; - h = ($(window).height() - Height)/2; + h = ($(window).height() - Height)/2 - 100; $("#ajax-modal").html(value); showModal('ajax-modal', Width + 'px'); $('#ajax-modal').siblings().remove(); @@ -1552,9 +1552,7 @@ function pop_box_new(value, Width, Height){ document.onmousemove = null; } - window.onload = function () { - new Drag("popupWrap"); - } + new Drag("popupWrap"); } // 公共提示弹框样式 From 55637808fffde740143b22e39bb90595424106b1 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 5 Aug 2016 18:07:54 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E5=93=81?= =?UTF-8?q?=EF=BC=9A=E4=B8=A4=E7=A7=8D=E8=A7=92=E8=89=B2=E7=9A=84=E6=88=90?= =?UTF-8?q?=E5=91=98=EF=BC=8C=E5=85=88=E5=AD=A6=E7=94=9F=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=EF=BC=8C=E5=86=8D=E6=95=99?= =?UTF-8?q?=E8=BE=85=E8=BA=AB=E4=BB=BD=E8=AF=84=E9=98=85=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E5=93=81=EF=BC=8C=E8=AF=84=E9=98=85=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=8D=E8=83=BD=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 6ea8baa29..adfcd6263 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -802,7 +802,6 @@ class StudentWorkController < ApplicationController #添加评分,已评分则为修改评分 def add_score @is_last = params[:is_last] == "true" - render_403 and return if User.current == @work.user #不可以匿评自己的作品 @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2 From a46aba1491a4071d8e686be34f4a15df8cd77b8f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Aug 2016 18:12:08 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=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/_show.html.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index be3970d3a..3fe189c98 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -11,20 +11,26 @@
<%= @request.title %>

<%= @request.description %>

请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> -
+ <% if @commits_count == 0 && @changes_count == 0 %> +
<%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>

请将新改动提交至源分支或者切换到其它目标分支

+
<% else %> <% if @request.state == "merged" %> +
<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %> 前合并

改动已合并至<%= @request.target_branch %>

+
<% else %> +
<% if is_project_manager?(User.current.id, @project.id) %> <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn", :remote => true %> <% end %> +
<% end %> -
+
  • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
  • From 910fe0f48ca5d71b13f4333fa3ae73dfdb9b5601 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Aug 2016 18:23:03 +0800 Subject: [PATCH 6/8] css --- app/views/pull_requests/_show.html.erb | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index 3fe189c98..68386625e 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -9,41 +9,41 @@
    <%= @request.title %>

    <%= @request.description %>

    -
    - 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> +
    + 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> -<% if @commits_count == 0 && @changes_count == 0 %> -
    - <%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>
    -

    请将新改动提交至源分支或者切换到其它目标分支

    -
    -<% else %> - <% if @request.state == "merged" %> -
    - <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %> 前合并
    -

    改动已合并至<%= @request.target_branch %>

    -
    + <% if @commits_count == 0 && @changes_count == 0 %> +
    + <%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>
    +

    请将新改动提交至源分支或者切换到其它目标分支

    +
    <% else %> -
    + <% if @request.state == "merged" %> +
    + <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %> 前合并
    +

    改动已合并至<%= @request.target_branch %>

    +
    + <% else %> <% if is_project_manager?(User.current.id, @project.id) %> - <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn", :remote => true %> +
    + <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn", :remote => true %> +
    <% end %> -
    - <% end %> + <% end %> -
    -
      -
    • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
    • -
    • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
    • -
    -
    根据最近提交时间排列
    -
    - <%= render :partial => "pull_requests/pull_request_commits" %> -
    -
    - <%= render :partial => "pull_requests/pull_request_changes" %> -
    - <% end %> +
    +
      +
    • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
    • +
    • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
    • +
    +
    根据最近提交时间排列
    +
    + <%= render :partial => "pull_requests/pull_request_commits" %> +
    +
    + <%= render :partial => "pull_requests/pull_request_changes" %> +
    + <% end %> From d3db6719ebae626be895a02484ca43db1033fc56 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 5 Aug 2016 18:41:32 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E2=80=9D=E4=B8=AD=E7=BC=96=E8=BE=91=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E4=B8=8D=E8=B7=B3=E8=BD=AC=E5=88=B0=E2=80=9C=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E2=80=9D=EF=BC=8C=E8=80=8C=E6=98=AF=E8=BF=94=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E4=BD=9C=E4=B8=9A=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 11 ++++++++--- app/views/homework_common/edit.html.erb | 15 ++++++++++----- app/views/users/_manage_homework_list.html.erb | 2 +- app/views/users/_my_homework_list.html.erb | 4 ++-- .../users/manage_or_receive_homeworks.html.erb | 2 +- .../users/manage_or_receive_homeworks.js.erb | 2 +- app/views/users/search_m_r_homeworks.js.erb | 2 +- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 2020915f8..2f50c8105 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -58,9 +58,10 @@ class HomeworkCommonController < ApplicationController def edit @user = User.current - @is_in_course = params[:is_in_course].to_i + @is_in_course = params[:is_in_course] + @is_manage = params[:is_manage] @course_activity = params[:course_activity].to_i - if @is_in_course == 1 || @course_activity == 1 + if @is_in_course.to_i == 1 || @course_activity == 1 @left_nav_type = 3 respond_to do |format| format.html{render :layout => 'base_courses'} @@ -144,7 +145,11 @@ class HomeworkCommonController < ApplicationController @homework_detail_programing.save if @homework_detail_programing @homework_detail_group.save if @homework_detail_group - if params[:is_in_course] == "1" + if params[:is_manage] == "1" + redirect_to manage_or_receive_homeworks_user_path(User.current.id) + elsif params[:is_manage] == "2" + redirect_to my_homeworks_user_path(User.current.id) + elsif params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => @course.id) elsif params[:is_in_course] == "0" redirect_to user_homeworks_user_path(User.current.id) diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index d4d9d7c16..1bd71e7a9 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -1,5 +1,5 @@