1、学生删除作品内文件功能

2、删除附件时提示
3、作品评论框与上一部分的间距
This commit is contained in:
sw 2015-06-04 13:52:28 +08:00
parent ae27e4062f
commit 891c22762f
3 changed files with 7 additions and 3 deletions

View File

@ -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?

View File

@ -60,7 +60,7 @@
<% end%>
</ul>
<div class="ping_box" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@work.student_works_scores.order("created_at desc").each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score}%>

View File

@ -1,7 +1,7 @@
<% attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
<%= link_to('&nbsp;'.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 %>
<span class="ml5">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>