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