课程资源中的图片点击下载有弹框改为预览图片

This commit is contained in:
z9hang 2015-03-20 17:26:31 +08:00
parent 80c35dcd96
commit bcfdac37a7
2 changed files with 9 additions and 2 deletions

View File

@ -14,9 +14,10 @@
</p>
</div>
<div class="cl"></div>
<div class="for_img_thumbnails">
<% curse_attachments.each do |file| %>
<div class="re_con_box">
<div class=" ">
<div class="">
<%= 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 (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
@ -50,6 +51,7 @@
<div class="cl"></div>
</div><!---re_con_box end-->
<% end %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>

View File

@ -632,7 +632,12 @@ function img_thumbnails() {
if (/\.(jpg|png|gif|bmp|jpeg|PNG|BMP|GIF|JPG|JPEG)$/.test(href_value)) {
$(element).colorbox({rel:'nofollow'});
}
});
$('.for_img_thumbnails').find('a').each(function(index, element) {
var href_value = $(element).attr('href');
if (/\.(jpg|png|gif|bmp|jpeg|PNG|BMP|GIF|JPG|JPEG)$/.test(href_value)) {
$(element).colorbox({rel:'nofollow'});
}
});
}
$(document).ready(img_thumbnails);