Merge remote-tracking branch 'origin/project_pack' into project_pack

project_pack
杨树明 5 years ago
commit 8ff11a2da3

@ -895,6 +895,8 @@ class AttachmentsController < ApplicationController
@school = @attachment.container @school = @attachment.container
elsif @attachment.container_type == 'Library' elsif @attachment.container_type == 'Library'
@library = @attachment.container @library = @attachment.container
elsif @attachment.container_type == 'ProjectPackage'
@package = @attachment.container
else 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' 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 @project = @attachment.project

@ -4375,6 +4375,8 @@ module ApplicationHelper
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
elsif attachment.container_type == "Library" #教学案例允许下载 elsif attachment.container_type == "Library" #教学案例允许下载
candown = true candown = true
elsif attachment.container_type == "ProjectPackage" #教学案例允许下载
candown = true
else else
candown = (attachment.is_public == 1 || attachment.is_public == true) candown = (attachment.is_public == 1 || attachment.is_public == true)
end end

@ -0,0 +1,8 @@
class AddIndexToProjectPackages < ActiveRecord::Migration
def change
add_index :project_packages, :creator_id
add_index :project_package_applies, :project_package_id
add_index :bidding_users, :project_package_id
add_index :bidding_users, :user_id
end
end
Loading…
Cancel
Save