Project

General

Profile

Feature #11543 » 11543-v2.patch

Yuichi HARADA, 2021-05-14 03:55

View differences:

app/views/attachments/_links.html.erb
12 12
             ) if attachments.size > 1 %>
13 13
</div>
14 14
<table>
15
<% for attachment in attachments %>
15
<thead>
16 16
<tr>
17
  <th style="width:20px;">#</th>
18
  <th><%= l(:field_name) %></th>
19
  <th><%= l(:field_description) %></th>
20
  <td></td>
21
  <td></td>
22
</tr>
23
</thead>
24
<tbody>
25
<% attachments.each_with_index do |attachment, index| %>
26
<tr>
27
  <td><%= index + 1 %></td>
17 28
  <td>
18 29
    <%= link_to_attachment attachment, class: 'icon icon-attachment' -%>
19 30
    <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
......
36 47
  </td>
37 48
</tr>
38 49
<% end %>
50
</tbody>
39 51
</table>
40 52
<% if defined?(thumbnails) && thumbnails %>
41 53
  <% images = attachments.select(&:thumbnailable?) %>
public/javascripts/application.js
1096 1096
  $(window).resize(setFilecontentContainerHeight);
1097 1097
}
1098 1098

  
1099
function setupWikiTableSortableHeader() {
1100
  $('div.wiki table').each(function(i, table){
1099
function setupTableSortableHeader(selector) {
1100
  $(selector).each(function(i, table){
1101 1101
    if (table.rows.length < 3) return true;
1102 1102
    var tr = $(table.rows).first();
1103 1103
    if (tr.find("TH").length > 0) {
......
1108 1108
  });
1109 1109
}
1110 1110

  
1111
function setupWikiTableSortableHeader() {
1112
  setupTableSortableHeader('div.wiki table');
1113
}
1114

  
1115
function setupAttachmentsTableSortableHeader() {
1116
  setupTableSortableHeader('div.attachments table');
1117
}
1118

  
1111 1119
$(function () {
1112 1120
  $("[title]:not(.no-tooltip)").tooltip({
1113 1121
    show: {
......
1209 1217
$(document).ready(setupTabs);
1210 1218
$(document).ready(setupFilePreviewNavigation);
1211 1219
$(document).ready(setupWikiTableSortableHeader);
1220
$(document).ready(setupAttachmentsTableSortableHeader);
1212 1221
$(document).on('focus', '[data-auto-complete=true]', function(event) {
1213 1222
  inlineAutoComplete(event.target);
1214 1223
});
public/stylesheets/application.css
938 938
div.attachments p { margin:4px 0 2px 0; }
939 939
div.attachments img { vertical-align: middle; }
940 940
div.attachments span.author { font-size: 0.9em; color: #888; }
941
div.attachments table { border-collapse:collapse; }
942
div.attachments table thead { border-bottom:1px solid #ccc; }
941 943

  
942 944
div.thumbnails {margin:0.6em;}
943 945
div.thumbnails div {background:#fff;border:2px solid #ddd;display:inline-block;margin-right:2px;}
(5-5/5)