55 lines
2.4 KiB
Plaintext
55 lines
2.4 KiB
Plaintext
<div class="attachments">
|
|
<% for attachment in attachments %>
|
|
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
<span title="<%= attachment.filename%>">
|
|
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
|
</span>
|
|
<% if attachment.is_text? %>
|
|
<%= link_to image_tag('magnifier.png'),
|
|
:controller => 'attachments',
|
|
:action => 'show',
|
|
:id => attachment,
|
|
:filename => attachment.filename%>
|
|
<% end %>
|
|
<span title="<%= attachment.description%>">
|
|
<%= h(truncate(" - #{attachment.description}", length: 15, omission: '...')) unless attachment.description.blank? %>
|
|
</span>
|
|
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
|
<% if options[:deletable] %>
|
|
<% if attachment.container_type == 'HomeworkAttach' %>
|
|
<%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id},
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
:method => :delete,
|
|
:class => 'delete',
|
|
:title => l(:button_delete) %>
|
|
<% else %>
|
|
<%= link_to image_tag('delete.png'), attachment_path(attachment),
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
:method => :delete,
|
|
:class => 'delete',
|
|
#:remote => true,
|
|
#:id => "attachments_" + attachment.id.to_s,
|
|
:title => l(:button_delete) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% if options[:author] %>
|
|
<!-- modified by zjc author添加超链接 -->
|
|
<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>
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
<% if defined?(thumbnails) && thumbnails %>
|
|
<% images = attachments.select(&:thumbnailable?) %>
|
|
<% if images.any? %>
|
|
<div class="thumbnails">
|
|
<% images.each do |attachment| %>
|
|
<div><%= thumbnail_tag(attachment) %></div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|