修改issue中图片附件的缩略图显示方式

This commit is contained in:
huang 2015-04-17 07:45:37 +08:00
parent d1e7777040
commit 0ea683e1b4
5 changed files with 20 additions and 8 deletions

View File

@ -325,6 +325,20 @@ module ApplicationHelper
:title => attachment.filename
end
def thumbnail_issue_tag(attachment)
imagesize = attachment.thumbnail(:size => "50*50")
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: '73', width: '100'),
imagepath,
:title => attachment.filename
end
end
# 图片缩略图链接
def thumbnail_small_tag(attachment)
imagesize = attachment.thumbnail(:size => "200*200")

View File

@ -5,7 +5,7 @@
<%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%>
<span title="<%= attachment.filename%>" id = "attachment_">
<span title="<%= attachment.filename %>" id = "attachment_">
<% if options[:length] %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% else %>
@ -62,11 +62,9 @@
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<div class="thumbnails">
<% images.each do |attachment| %>
<div><%= thumbnail_tag(attachment) %></div>
<div class="pro_pic fl " width="100" height="73"><%= thumbnail_issue_tag(attachment) %></div>
<% end %>
</div>
<% end %>
<% end %>
</div>

View File

@ -18,7 +18,7 @@
<%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
</div>
<% end %>
<fieldset><legend>说明</legend>
<fieldset><legend>回复</legend>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
</fieldset>
<!--<%# if @issue.safe_attribute? 'private_notes' %>-->
@ -29,7 +29,7 @@
<!--</fieldset>-->
<!--<fieldset><legend><%#= l(:label_attachment_plural) %></legend>-->
<!--<p style="padding-top: 5px;"><%= render :partial => 'attachments/new_form', :locals => {:container => @issue} %>-->
<!--<p style="padding-top: 5px;"><%#= render :partial => 'attachments/new_form', :locals => {:container => @issue} %>
<!--</fieldset>-->
<div class="cl"></div>

View File

@ -13,7 +13,7 @@
<% if journal.details.any? %>
<% details_to_strings(journal.details).each do |string| %>
<%= string %>
<% end %> </span>
<% end %>
<% end %>
</p>
</div>

View File

@ -115,7 +115,7 @@
</div>
<% end %>
<!--留言-->
<br>
<p style="padding-top: 5px"></p>
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="$('#issue-form').submit();">
<%= l(:button_submit) %>
</a>