Project

General

Profile

Defect #30125 » 30125.patch

Yuichi HARADA, 2021-03-26 06:57

View differences:

app/views/issues/_edit.html.erb
<% if @issue.attachments.any? && @issue.safe_attribute?('deleted_attachment_ids') %>
<div class="contextual"><%= link_to l(:label_edit_attachments), '#', :onclick => "$('#existing-attachments').toggle(); return false;" %></div>
<div id="existing-attachments" style="<%= @issue.deleted_attachment_ids.blank? ? 'display:none;' : '' %>">
<table>
<% @issue.attachments.each do |attachment| %>
<span class="existing-attachment">
<%= text_field_tag '', attachment.filename, :class => "icon icon-attachment filename", :disabled => true %>
<label>
<%= check_box_tag 'issue[deleted_attachment_ids][]',
attachment.id,
@issue.deleted_attachment_ids.include?(attachment.id),
:id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %>
</label>
</span>
<tr class="existing-attachment">
<td>
<span class="icon icon-attachment filename"><%= attachment.filename %></span>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
</td>
<td><span class="description"><%= attachment.description unless attachment.description.blank? %></span></td>
<td>
<span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
</td>
<td>
<label>
<%= check_box_tag 'issue[deleted_attachment_ids][]',
attachment.id,
@issue.deleted_attachment_ids.include?(attachment.id),
:id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %>
</label>
</td>
</tr>
<% end %>
</table>
<hr />
</div>
<% end %>
app/views/wiki/edit.html.erb
<% if @page.attachments.any? && @page.safe_attribute?('deleted_attachment_ids') %>
<div class="contextual"><%= link_to l(:label_edit_attachments), '#', :onclick => "$('#existing-attachments').toggle(); return false;" %></div>
<div id="existing-attachments" style="<%= @page.deleted_attachment_ids.blank? ? 'display:none;' : '' %>">
<table>
<% @page.attachments.each do |attachment| %>
<span class="existing-attachment">
<%= text_field_tag '', attachment.filename, :class => "icon icon-attachment filename", :disabled => true %>
<label class='inline'>
<%= check_box_tag 'wiki_page[deleted_attachment_ids][]',
attachment.id,
@page.deleted_attachment_ids.include?(attachment.id),
:id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %>
</label>
</span>
<tr class="existing-attachment">
<td>
<span class="icon icon-attachment filename"><%= attachment.filename %></span>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
</td>
<td><span class="description"><%= attachment.description unless attachment.description.blank? %></span></td>
<td>
<span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
</td>
<td>
<label class="inline">
<%= check_box_tag 'wiki_page[deleted_attachment_ids][]',
attachment.id,
@page.deleted_attachment_ids.include?(attachment.id),
:id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %>
</label>
</td>
</tr>
<% end %>
</table>
<hr />
</div>
<% end %>
public/stylesheets/application.css
.check_box_group.bool_cf {border:0; background:inherit;}
.check_box_group.bool_cf label {display: inline;}
.attachments_fields input.description, #existing-attachments input.description {margin-left:4px; width:340px;}
.attachments_fields>span, #existing-attachments>span {display:block; white-space:nowrap;}
.attachments_fields input.filename, #existing-attachments .filename {border:0; width:250px; color:#555; background-color:inherit; }
.attachments_fields input.description {margin-left:4px; width:340px;}
.attachments_fields>span {display:block; white-space:nowrap;}
.attachments_fields input.filename {border:0; width:250px; color:#555; background-color:inherit; }
.tabular input.filename {max-width:75% !important;}
.attachments_fields input.filename {height:1.8em;}
.attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
.attachments_fields .ajax-loading input.filename {background:url(../images/loading.gif) no-repeat 0px 50%;}
.attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
.existing-attachment .filename {display:block; float:left; max-width:250px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
.existing-attachment .size {margin-left:2px;}
.existing-attachment .description {display:block; max-width:200px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
a.remove-upload:hover {text-decoration:none !important;}
.existing-attachment.deleted .filename {text-decoration:line-through; color:#999 !important;}
(4-4/4)