1、学生看不到私有资源bug。2、引用资源弹框中无课程可显示时不显示引入我的课程按钮。3、引用资源时提示信息样式修改
This commit is contained in:
parent
b0db7dfece
commit
9898e1650b
|
@ -351,8 +351,13 @@ class AttachmentsController < ApplicationController
|
|||
courses.each do |course|
|
||||
c = Course.find(course);
|
||||
if course_contains_attachment?(c,file)
|
||||
@message += l(:label_course_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
|
||||
next
|
||||
if @message && @message == ""
|
||||
@message += l(:label_course_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
|
||||
next
|
||||
else
|
||||
@message += "<br/>" + l(:label_course_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
|
||||
next
|
||||
end
|
||||
end
|
||||
attach_copied_obj = file.copy
|
||||
attach_copied_obj.tag_list.add(file.tag_list) # tag关联
|
||||
|
|
|
@ -69,7 +69,7 @@ module AttachmentsHelper
|
|||
|
||||
def course_contains_attachment? course,attachment
|
||||
course.attachments.each do |att|
|
||||
if att.id == attachment.id || att.copy_from == attachment.copy_from || att.copy_from = attachment.id || att.id == attachment.copy_from
|
||||
if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,11 +54,11 @@ module FilesHelper
|
|||
s.html_safe
|
||||
end
|
||||
|
||||
#判断用户是否拥有课程,需用户在该课程中角色为教师
|
||||
#判断用户是否拥有课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
|
||||
def has_course? user
|
||||
result = false
|
||||
user.courses.each do |course|
|
||||
if is_course_teacher(user,course)
|
||||
if is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -86,7 +86,7 @@ module FilesHelper
|
|||
def visable_attachemnts attachments
|
||||
result = []
|
||||
attachments.each do |attachment|
|
||||
if attachment.is_public? || attachment.author_id == User.current.id
|
||||
if attachment.is_public? || (attachment.container_type == "Course" && attachment.author.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% if !@save_flag && @save_message %>
|
||||
$("#error_show").html("<%= @save_message.join(', ') %>");
|
||||
<% elsif @message || @message != "" %>
|
||||
$("#error_show").html("<%= @message %>");
|
||||
<% elsif @message && @message != "" %>
|
||||
$("#error_show").html("<%= @message.html_safe %>");
|
||||
<% else %>
|
||||
closeModal();
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue