2014-11-03 15:35:29 +08:00
|
|
|
<div class="attachments" style="font-weight:normal;">
|
2015-02-06 10:51:29 +08:00
|
|
|
<% is_float ||= false %>
|
2014-10-23 11:30:34 +08:00
|
|
|
<% for attachment in attachments %>
|
|
|
|
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
2015-02-06 10:51:29 +08:00
|
|
|
<%if is_float%>
|
|
|
|
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
|
|
|
|
<% end%>
|
2015-02-03 10:42:36 +08:00
|
|
|
<span title="<%= attachment.filename%>" id = "attachment_">
|
|
|
|
<% if options[:length] %>
|
|
|
|
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%>
|
|
|
|
<% else %>
|
|
|
|
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
2015-02-06 10:51:29 +08:00
|
|
|
<%if is_float%>
|
|
|
|
</div>
|
|
|
|
<% end%>
|
|
|
|
|
2014-10-23 11:30:34 +08:00
|
|
|
<% if attachment.is_text? %>
|
|
|
|
<%= link_to image_tag('magnifier.png'),
|
|
|
|
:controller => 'attachments',
|
|
|
|
:action => 'show',
|
|
|
|
:id => attachment,
|
|
|
|
:filename => attachment.filename%>
|
|
|
|
<% end %>
|
|
|
|
<span title="<%= attachment.description%>">
|
2014-10-31 11:03:17 +08:00
|
|
|
<%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %>
|
2014-10-23 11:30:34 +08:00
|
|
|
</span>
|
2015-02-03 10:42:36 +08:00
|
|
|
<span class="size">(
|
|
|
|
<%= number_to_human_size attachment.filesize %>)
|
|
|
|
</span>
|
2014-10-23 11:30:34 +08:00
|
|
|
<% 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,
|
2015-03-11 10:52:09 +08:00
|
|
|
:class => 'delete delete-homework-icon',
|
|
|
|
:remote => true,
|
2014-10-23 11:30:34 +08:00
|
|
|
: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 %>
|
2014-10-31 11:03:17 +08:00
|
|
|
<% if options[:wrap] %>
|
2015-02-03 10:42:36 +08:00
|
|
|
<br/>
|
|
|
|
|
2014-10-31 11:03:17 +08:00
|
|
|
<% end %>
|
2014-10-23 11:30:34 +08:00
|
|
|
<% if options[:author] %>
|
2014-10-28 17:25:46 +08:00
|
|
|
<span class="author" title="<%= attachment.author%>">
|
2014-10-23 11:30:34 +08:00
|
|
|
<%= 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>
|