From 17b50cbb976bdbced46e17bbc7082646ca1b3d28 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 12 Jul 2019 14:55:51 +0800 Subject: [PATCH] attachment download support project package --- app/controllers/attachments_controller.rb | 2 ++ app/helpers/application_helper.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 428e1157..b0a7be31 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -895,6 +895,8 @@ class AttachmentsController < ApplicationController @school = @attachment.container elsif @attachment.container_type == 'Library' @library = @attachment.container + elsif @attachment.container_type == 'ProjectPackage' + @package = @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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 05e1e2ce..87a0e22b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4375,6 +4375,8 @@ module ApplicationHelper 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 + elsif attachment.container_type == "ProjectPackage" #教学案例允许下载 + candown = true else candown = (attachment.is_public == 1 || attachment.is_public == true) end