|
|
|
@ -172,7 +172,7 @@ class AttachmentsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
# modify by nwb
|
|
|
|
|
if @attachment.container_type == 'Course'
|
|
|
|
|
if @attachment.container.is_a?(Course) || @attachment.container.course
|
|
|
|
|
if @course.nil?
|
|
|
|
|
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
|
|
|
|
else
|
|
|
|
@ -285,6 +285,8 @@ private
|
|
|
|
|
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
|
|
|
|
|
if @attachment.container_type == 'Course'
|
|
|
|
|
@course = @attachment.course
|
|
|
|
|
elsif @attachment.container.course
|
|
|
|
|
@course = @attachment.container.course
|
|
|
|
|
else
|
|
|
|
|
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'
|
|
|
|
|
@project = @attachment.project
|
|
|
|
|