From d6fb35544ecbe9abe4dc8faae8bc3bb1a1946814 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 09:01:49 +0800
Subject: [PATCH 01/15] =?UTF-8?q?=E8=AF=84=E5=88=86=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E6=97=B6=E6=8F=90=E4=BA=A4=E6=8C=89=E9=92=AE=E5=9B=BA=E5=AE=9A?=
=?UTF-8?q?=E5=9C=A8=E6=8F=90=E4=BA=A4=E6=A0=8F=E7=9A=84=E5=8F=B3=E4=B8=8B?=
=?UTF-8?q?=E8=A7=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_add_score.html.erb | 2 +-
app/views/student_work/_show.html.erb | 2 +-
public/stylesheets/courses.css | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
index e091e507d..bdfcff6e1 100644
--- a/app/views/student_work/_add_score.html.erb
+++ b/app/views/student_work/_add_score.html.erb
@@ -16,7 +16,7 @@
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
<%end%>
- 提交
+ 提交
+
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
<% end%>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 85db8361d..0663dc905 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -671,6 +671,8 @@ input#score{ width:40px;}
.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;}
.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px;}
+.evaluation{position: relative;}
+.evaluation_submit{position: absolute;right: 0px;bottom: 5px;}
From f168e43b0fb92e2d49f5cd6ad3950a586cffc02b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 09:57:30 +0800
Subject: [PATCH 02/15] =?UTF-8?q?1=E3=80=81=E8=BF=94=E8=BF=98=E6=89=B9?=
=?UTF-8?q?=E9=98=85=E7=9A=84=E9=99=84=E4=BB=B6=E5=8F=AF=E4=BB=A5=E5=88=A0?=
=?UTF-8?q?=E9=99=A4=E5=B9=B6=E4=B8=94js=E5=88=B7=E6=96=B0=202=E3=80=81?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8F=AF=E4=BB=A5=E5=9C=A8=E4=BD=9C=E5=93=81?=
=?UTF-8?q?show=E7=95=8C=E9=9D=A2=E5=88=A0=E9=99=A4=E8=87=AA=E5=B7=B1?=
=?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E7=9A=84=E9=99=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 10 +++-
app/controllers/homework_attach_controller.rb | 5 +-
app/controllers/homework_common_controller.rb | 3 ++
app/views/attachments/destroy.js.erb | 52 ++++++++++---------
.../student_work/_work_attachments.html.erb | 11 ++--
5 files changed, 48 insertions(+), 33 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index c8b6a6fda..46428d5e8 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -191,9 +191,15 @@ class AttachmentsController < ApplicationController
if !@attachment.container.nil? &&
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
- @attachment.container.board && @attachment.container.board.course ) )
+ @attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon))
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
+ elsif @attachment.container.is_a?(StudentWorksScore)
+ @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ format.js
+ elsif @attachment.container.is_a?(HomeworkCommon)
+ @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ format.js
elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
elsif @course.nil?
@@ -431,7 +437,7 @@ private
@attachment.container.board.course)
@course = @attachment.container.board.course
else
- unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWorks'
+ unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
@project = @attachment.project
end
end
diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index f6b044c63..5dd5363b9 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -334,9 +334,8 @@ class HomeworkAttachController < ApplicationController
@homework.name = name
@homework.description = description
@homework.project_id = params[:project_id] || 0
- if params[:attachments]
- @homework.save_attachments(params[:attachments])
- end
+ @homework.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@homework)
if @homework.save
respond_to do |format|
format.html { redirect_to course_for_bid_url @homework.bid }
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 58c959512..281ff7cf8 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -101,6 +101,9 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = params[:absence_penalty]
+ @homework.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@homework)
+
if @homework.save && @homework_detail_manual.save
respond_to do |format|
format.html {
diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb
index 0b6cee0df..d23422e24 100644
--- a/app/views/attachments/destroy.js.erb
+++ b/app/views/attachments/destroy.js.erb
@@ -1,26 +1,30 @@
-var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
-//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
-var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
-if(containerid==undefined){
- $('#attachments_<%= j params[:attachment_id] %>').remove();
- var count=$('#attachments_fields>span').length;
- if(count<=0){
- $("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
- $(".remove_all").remove();
+<% if @is_destroy%>
+ $("#attachment_<%= @attachment.id%>").remove();
+<%else%>
+ var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
+ //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
+ var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
+ if(containerid==undefined){
+ $('#attachments_<%= j params[:attachment_id] %>').remove();
+ var count=$('#attachments_fields>span').length;
+ if(count<=0){
+ $("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
+ $(".remove_all").remove();
+ }else{
+ $("#upload_file_count").html("
"+count+""+"个文件"+"已上传");
+ }
}else{
- $("#upload_file_count").html("
"+count+""+"个文件"+"已上传");
+ $('#attachments_<%= j params[:attachment_id] %>').remove();
+ var count=$('#attachments_fields'+containerid+'>span').length;
+ if(count<=0){
+ $('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
+ var remove_all_html_obj = $(".remove_all").filter(function(index){
+ return $(this).data('containerid')==containerid;
+ });
+ remove_all_html_obj.remove();
+ }else{
+ $('#upload_file_count'+containerid).html("
"+count+""+"个文件"+"已上传");
+ }
}
-}else{
- $('#attachments_<%= j params[:attachment_id] %>').remove();
- var count=$('#attachments_fields'+containerid+'>span').length;
- if(count<=0){
- $('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
- var remove_all_html_obj = $(".remove_all").filter(function(index){
- return $(this).data('containerid')==containerid;
- });
- remove_all_html_obj.remove();
- }else{
- $('#upload_file_count'+containerid).html("
"+count+""+"个文件"+"已上传");
- }
-}
-//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
\ No newline at end of file
+ //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
+<% end%>
\ No newline at end of file
diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb
index 638644fdf..2f7e1e1cd 100644
--- a/app/views/student_work/_work_attachments.html.erb
+++ b/app/views/student_work/_work_attachments.html.erb
@@ -1,5 +1,8 @@
-<% for attachment in attachments %>
- <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
-
(<%= number_to_human_size attachment.filesize %>)
-
+<% attachments.each_with_index do |attachment,i| %>
+
+ <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
+
(<%= number_to_human_size attachment.filesize %>)
+
+
<% end -%>
From b822db9995be41fbac011022220ec380c7152a09 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:00:08 +0800
Subject: [PATCH 03/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A2=9E=E5=8A=A0title?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_work_attachments.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb
index 2f7e1e1cd..373b84b74 100644
--- a/app/views/student_work/_work_attachments.html.erb
+++ b/app/views/student_work/_work_attachments.html.erb
@@ -1,7 +1,7 @@
<% attachments.each_with_index do |attachment,i| %>
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
- <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
(<%= number_to_human_size attachment.filesize %>)
From ae950cf3c0fa3ff3856ee0d3117242ea64cabd4b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:10:16 +0800
Subject: [PATCH 04/15] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AF=84=E5=88=86?=
=?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E7=BC=BA=E5=B0=91=E5=85=B3=E9=97=AD?=
=?UTF-8?q?=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/show_member_score.js.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/courses/show_member_score.js.erb b/app/views/courses/show_member_score.js.erb
index 083f070c2..013b478fc 100644
--- a/app/views/courses/show_member_score.js.erb
+++ b/app/views/courses/show_member_score.js.erb
@@ -6,8 +6,8 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/show_me
showModal('ajax-modal', '400px');
//$('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("
" +
-"");
+$('#ajax-modal').before("
" +
+"");
//$('#ajax-modal').parent().removeClass();
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed");
$('#ajax-modal').parent().addClass("new-watcher");
From b7dbaca15b12a18fbae840daf2b2b0da0f9b8d87 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:29:00 +0800
Subject: [PATCH 05/15] =?UTF-8?q?=E5=9C=A8=E5=AD=A6=E7=94=9F=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=EF=BC=8C=E7=82=B9=E5=87=BB=E5=AD=A6=E7=94=9F=E7=A7=AF?=
=?UTF-8?q?=E5=88=86=E4=B9=8B=E5=90=8E=EF=BC=8Ca=E6=A0=87=E7=AD=BE?=
=?UTF-8?q?=E6=9C=89=E4=B8=8B=E5=88=92=E7=BA=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/_show_member_score.html.erb | 33 +++++--------------
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb
index bb080b57b..0d250cf14 100644
--- a/app/views/courses/_show_member_score.html.erb
+++ b/app/views/courses/_show_member_score.html.erb
@@ -1,24 +1,5 @@