课程私有资源不显示在没有权限查看的用户上
This commit is contained in:
parent
5954ced7a7
commit
a84af9d138
|
@ -736,4 +736,14 @@ module CoursesHelper
|
||||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def visable_attachemnts_incourse course
|
||||||
|
result = []
|
||||||
|
course.attachments.each do |attachment|
|
||||||
|
if attachment.is_public? || User.current.member_of_course?(course)
|
||||||
|
result << attachment
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -97,16 +97,6 @@ module FilesHelper
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def visable_attachemnts_incourse attachments
|
|
||||||
result = []
|
|
||||||
attachments.each do |attachment|
|
|
||||||
if attachment.is_public? || (attachment.author.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
|
|
||||||
result << attachment
|
|
||||||
end
|
|
||||||
end
|
|
||||||
result
|
|
||||||
end
|
|
||||||
|
|
||||||
def visable_attachemnts_insite attachments,course
|
def visable_attachemnts_insite attachments,course
|
||||||
result = []
|
result = []
|
||||||
attachments.each do |attachment|
|
attachments.each do |attachment|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<% course_model %>
|
<% course_model %>
|
||||||
<% teacher_num = teacherCount(@course) %>
|
<% teacher_num = teacherCount(@course) %>
|
||||||
<% student_num = studentCount(@course) %>
|
<% student_num = studentCount(@course) %>
|
||||||
|
<% course_file_num = visable_attachemnts_incourse(@course).count%>
|
||||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
@ -94,7 +95,7 @@
|
||||||
<span>| </span>
|
<span>| </span>
|
||||||
<%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>)
|
<%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>)
|
||||||
<span>| </span>
|
<span>| </span>
|
||||||
<%= l(:project_module_attachments)%>(<%= link_to @course.attachments.count, course_files_path(@course), :class => 'info_foot_num c_blue' %>)</div>
|
<%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue' %>)</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div><!--课程信息 end-->
|
</div><!--课程信息 end-->
|
||||||
<div class="info_box">
|
<div class="info_box">
|
||||||
|
@ -125,7 +126,9 @@
|
||||||
<%= link_to( "+#{l(:label_course_news_new)}", new_course_news_path(@course), :class => 'subnav_green c_white') if is_teacher %>
|
<%= link_to( "+#{l(:label_course_news_new)}", new_course_news_path(@course), :class => 'subnav_green c_white') if is_teacher %>
|
||||||
</div>
|
</div>
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %><%= link_to "(#{@course.attachments.count})", course_files_path(@course), :class => "subnav_num c_orange" %><%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %>
|
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
|
||||||
|
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange" %>
|
||||||
|
<%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %>
|
||||||
</div>
|
</div>
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
|
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
|
||||||
|
|
Loading…
Reference in New Issue