From 4156983494500a24ed4fdf9352b86f2f7bb4c205 Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 20 May 2014 15:05:54 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 20 ++++++++++++++++++-- app/models/attachment.rb | 1 - app/views/attachments/_links.html.erb | 2 +- app/views/users/_my_course.html.erb | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6b8525a00..0c4514769 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -182,11 +182,27 @@ module ApplicationHelper end def thumbnail_tag(attachment) - link_to image_tag(thumbnail_path(attachment)), - named_attachment_path(attachment, attachment.filename), + imagepath = named_attachment_path(attachment, attachment.filename) + link_to image_tag(imagepath), + imagepath , :title => attachment.filename end + # 图片缩略图链接 + def thumbnail_small_tag(attachment) + imagesize = attachment.thumbnail(:size => "200*200") + imagepath = named_attachment_path(attachment, attachment.filename) + if imagesize + link_to image_tag(imagesize), + imagepath, + :title => attachment.filename + else + link_to image_tag(imagepath , height: '200', width: '250'), + imagepath, + :title => attachment.filename + end + end + def toggle_link(name, id, options={}) onclick = "$('##{id}').toggle(); " onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 661762e5c..aff63439e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -228,7 +228,6 @@ class Attachment < ActiveRecord::Base end size = 100 unless size > 0 target = File.join(self.class.thumbnails_storage_path, "#{id}_#{digest}_#{size}.thumb") - begin Redmine::Thumbnail.generate(self.diskfile, target, size) rescue => e diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index c135ee214..f73df8fb4 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -33,7 +33,7 @@ <% if images.any? %>
<% images.each do |attachment| %> -
<%= thumbnail_tag(attachment) %>
+
<%= thumbnail_small_tag(attachment) %>
<% end %>
<% end %> diff --git a/app/views/users/_my_course.html.erb b/app/views/users/_my_course.html.erb index 2fb2b5bde..8feb0ecca 100644 --- a/app/views/users/_my_course.html.erb +++ b/app/views/users/_my_course.html.erb @@ -12,7 +12,7 @@ <% end %> <% else %>

- <%=l(:label_course_doing)%>(<%=@memberships_doing.count%>) + <%=l(:label_course_doing)%>(<%=@memberships_doing.count%>) <%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %>

From dac992548a03698c68967f309f68bf13191e50db Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 14:52:30 +0800 Subject: [PATCH 2/4] course_form --- app/views/users/_course_form.html.erb | 113 +++++++++++++------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index cadebff41..058c92d4e 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,56 +1,59 @@

- -
- <%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file + + +<%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file From 85c77ca074ddc9e019324bb38a416408560a7400 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 15:37:05 +0800 Subject: [PATCH 3/4] xss, ckeditor js bug. --- app/views/memos/show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index fcd10a011..91bb1387d 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -110,8 +110,7 @@ <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> -
<%=h reply.content.html_safe %>
- +
<%=h sanitize(reply.content.html_safe) %>

<% if reply.attachments.any?%> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> @@ -144,6 +143,7 @@ \ No newline at end of file From 4aed14228a830d9f590eb874abc65256ce5d2f3e Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 15:53:23 +0800 Subject: [PATCH 4/4] project/course/ members remove link --- app/views/projects/_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/_course.html.erb b/app/views/projects/_course.html.erb index 58168c999..adc7c9306 100644 --- a/app/views/projects/_course.html.erb +++ b/app/views/projects/_course.html.erb @@ -45,7 +45,7 @@ <%= content_tag('span', l(:label_x_data,:count => files_count)) %>

- <%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %> + <%= content_tag('span', "#{@project.members.count}", :class => "info") %> <%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>