2013-08-01 10:33:49 +08:00
|
|
|
<div class="attachments">
|
|
|
|
<% for attachment in attachments %>
|
2014-07-30 13:52:55 +08:00
|
|
|
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
|
|
<span title="<%= attachment.filename%>">
|
2014-09-17 15:04:41 +08:00
|
|
|
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
2014-07-30 13:52:55 +08:00
|
|
|
</span>
|
2013-08-01 10:33:49 +08:00
|
|
|
<% if attachment.is_text? %>
|
|
|
|
<%= link_to image_tag('magnifier.png'),
|
2014-09-16 11:21:06 +08:00
|
|
|
:controller => 'attachments',
|
|
|
|
:action => 'show',
|
|
|
|
:id => attachment,
|
|
|
|
:filename => attachment.filename%>
|
2013-08-01 10:33:49 +08:00
|
|
|
<% end %>
|
2014-09-17 14:14:17 +08:00
|
|
|
<span title="<%= attachment.description%>">
|
2014-09-18 16:20:58 +08:00
|
|
|
<%= h(truncate(" - #{attachment.description}", length: 15, omission: '...')) unless attachment.description.blank? %>
|
2014-09-17 14:14:17 +08:00
|
|
|
</span>
|
2013-08-01 10:33:49 +08:00
|
|
|
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
|
|
|
<% if options[:deletable] %>
|
2014-03-05 11:17:16 +08:00
|
|
|
<% if attachment.container_type == 'HomeworkAttach' %>
|
|
|
|
<%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id},
|
2013-08-01 10:33:49 +08:00
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
:method => :delete,
|
|
|
|
:class => 'delete',
|
|
|
|
:title => l(:button_delete) %>
|
2014-07-28 11:29:55 +08:00
|
|
|
<% else %>
|
2014-03-05 11:17:16 +08:00
|
|
|
<%= link_to image_tag('delete.png'), attachment_path(attachment),
|
2013-09-18 22:56:01 +08:00
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
:method => :delete,
|
|
|
|
:class => 'delete',
|
2014-08-14 16:19:40 +08:00
|
|
|
#:remote => true,
|
2014-07-30 15:48:13 +08:00
|
|
|
#:id => "attachments_" + attachment.id.to_s,
|
2013-09-18 22:56:01 +08:00
|
|
|
:title => l(:button_delete) %>
|
|
|
|
<% end %>
|
2013-08-01 10:33:49 +08:00
|
|
|
<% end %>
|
|
|
|
<% if options[:author] %>
|
2014-06-18 17:35:05 +08:00
|
|
|
<!-- modified by zjc author添加超链接 -->
|
2014-09-18 16:20:58 +08:00
|
|
|
<span class="author" title="attachment.author">
|
|
|
|
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>,
|
|
|
|
<%= format_time(attachment.created_on) %>
|
|
|
|
</span>
|
2013-08-01 10:33:49 +08:00
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
<% end %>
|
|
|
|
<% if defined?(thumbnails) && thumbnails %>
|
|
|
|
<% images = attachments.select(&:thumbnailable?) %>
|
|
|
|
<% if images.any? %>
|
|
|
|
<div class="thumbnails">
|
|
|
|
<% images.each do |attachment| %>
|
2014-06-13 15:42:59 +08:00
|
|
|
<div><%= thumbnail_tag(attachment) %></div>
|
2013-08-01 10:33:49 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|