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