From 891c22762f1e742e68dec4467bd5f39d7a047c40 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 4 Jun 2015 13:52:28 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AD=A6=E7=94=9F=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=86=85=E6=96=87=E4=BB=B6=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=202=E3=80=81=E5=88=A0=E9=99=A4=E9=99=84=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=203=E3=80=81=E4=BD=9C=E5=93=81=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E6=A1=86=E4=B8=8E=E4=B8=8A=E4=B8=80=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=9A=84=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 +++++- app/views/student_work/_show.html.erb | 2 +- app/views/student_work/_work_attachments.html.erb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 46428d5e8..c310087f7 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -191,7 +191,8 @@ 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.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon)) + @attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) || + @attachment.container.is_a?(StudentWork)) if @attachment.container.is_a?(News) format.html { redirect_to_referer_or news_path(@attachment.container) } elsif @attachment.container.is_a?(StudentWorksScore) @@ -200,6 +201,9 @@ class AttachmentsController < ApplicationController elsif @attachment.container.is_a?(HomeworkCommon) @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 format.js + elsif @attachment.container.is_a?(StudentWork) + @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? diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 603875d5b..4e9f337c0 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -60,7 +60,7 @@ <% end%> -
+
<%@work.student_works_scores.order("created_at desc").each do |score|%>
<%= render :partial => 'student_work_score',:locals => {:score => score}%> diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb index 373b84b74..f303897bc 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, :title => '删除', :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', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %> (<%= number_to_human_size attachment.filesize %>)