缺陷附件只能用户自己本身删除

This commit is contained in:
huang 2015-07-28 17:17:52 +08:00
parent a37505db2e
commit 6a9cb0db5d
1 changed files with 33 additions and 23 deletions

View File

@ -29,32 +29,32 @@
<% is_float ||= false %>
<% for attachment in attachments %>
<div style="float:left;">
<p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%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_">
<p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%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_">
<% if options[:length] %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% else %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%>
<% end %>
</span>
<%if is_float%>
</div>
<% end%>
<%if is_float%>
</div>
<% end%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename%>
<% end %>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename%>
<% end %>
</div>
<div style="float:left;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<%= attachment.description%>">
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
</div>
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
</div>
<span class="size">(
<%= number_to_human_size attachment.filesize %>)
</span>
@ -66,6 +66,16 @@
:class => 'delete delete-homework-icon',
:remote => true,
:title => l(:button_delete) %>
<% elsif attachment.container_type == 'Issue' %>
<% if User.current == attachment.author %>
<%= 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 %>
<% else %>
<%= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
@ -89,13 +99,13 @@
</p>
<% end %>
<div class="thumbnails">
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<% images.each do |attachment| %>
<div class="pro_pic fl " width="100" height="73"><%= thumbnail_issue_tag(attachment) %></div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>