From bcfdac37a72eef6c0e3e684bb325a3623ee13804 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 20 Mar 2015 17:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E7=82=B9=E5=87=BB=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=9C=89=E5=BC=B9=E6=A1=86=E6=94=B9=E4=B8=BA=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_list.html.erb | 4 +++- public/javascripts/application.js | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 8af369558..a90d47b5a 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -14,9 +14,10 @@

+
<% curse_attachments.each do |file| %>
-
+
<%= 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 @@
<% end %> +
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 18afa7f67..5d2423238 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -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);