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

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