缺陷添加缩略图显示
This commit is contained in:
parent
097489e594
commit
4156983494
|
@ -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(); ")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<% if images.any? %>
|
||||
<div class="thumbnails">
|
||||
<% images.each do |attachment| %>
|
||||
<div><%= thumbnail_tag(attachment) %></div>
|
||||
<div><%= thumbnail_small_tag(attachment) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<% end %>
|
||||
<% else %>
|
||||
<p>
|
||||
<span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span>
|
||||
<span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span>
|
||||
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %>
|
||||
</p>
|
||||
<p>
|
||||
|
|
Loading…
Reference in New Issue