Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
a64cae5da3
|
@ -1,5 +1,6 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
module FilesHelper
|
module FilesHelper
|
||||||
|
include AttachmentsHelper
|
||||||
|
|
||||||
def downloadAll containers
|
def downloadAll containers
|
||||||
paths = []
|
paths = []
|
||||||
|
@ -54,11 +55,11 @@ module FilesHelper
|
||||||
s.html_safe
|
s.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
#判断用户是否拥有除current_course以外的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
|
#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
|
||||||
def has_course? user,current_course
|
def has_course? user,file
|
||||||
result = false
|
result = false
|
||||||
user.courses.each do |course|
|
user.courses.each do |course|
|
||||||
if current_course.id != course.id && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
|
if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<% if is_course_teacher(User.current,@course) && file.author_id == User.current.id %>
|
<% if is_course_teacher(User.current,@course) && file.author_id == User.current.id %>
|
||||||
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,@course) %>
|
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
|
||||||
|
|
||||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||||
<span id="is_public_<%= file.id %>">
|
<span id="is_public_<%= file.id %>">
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,@course) %>
|
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue