dev_bj
caishi 6 years ago
commit 696190000d

@ -893,6 +893,8 @@ class AttachmentsController < ApplicationController
@subject = @attachment.container
elsif @attachment.container_type == 'School'
@school = @attachment.container
elsif @attachment.container_type == 'Library'
@library = @attachment.container
else
unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore' || @attachment.container_type == 'StudentWork' || @attachment.container_type == 'Work'|| @attachment.container_type == 'ContestantWork'|| @attachment.container_type == 'Contest' || @attachment.container_type == 'HomeworkBank' || @attachment.container_type == 'Exercise' || @attachment.container_type == 'ExerciseBank' || @attachment.container_type == 'Career' || @attachment.container_type == 'EcTemplate'
@project = @attachment.project

@ -22,7 +22,7 @@ class LibrariesController < ApplicationController
def show
@library = Library.find(params[:id])
return redirect_to libraries_path unless admin_or_self?
return render_403 unless admin_or_self? || @library.published?
@library_applies = @library.library_applies.where(status: :refused).order('created_at desc')
@library.increment_visited_count!

@ -4368,6 +4368,8 @@ module ApplicationHelper
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
course = attachment.container.courses.first
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
elsif attachment.container_type == "Library" #文库允许下载
candown = true
else
candown = (attachment.is_public == 1 || attachment.is_public == true)
end

Loading…
Cancel
Save