Project

General

Profile

Feature #11543 » 11543.patch

Yuichi HARADA, 2021-03-31 10:09

View differences:

app/views/attachments/_links.html.erb
12 12
             ) if attachments.size > 1 %>
13 13
</div>
14 14
<table>
15
<thead>
16
<tr>
17
  <th><%= l(:field_name) %></th>
18
  <th><%= l(:field_description) %></th>
19
<% if options[:author] %>
20
  <th><%= l(:field_author) %></th>
21
  <th><%= l(:field_created_on) %></th>
22
<% end %>
23
  <td></td>
24
</tr>
25
</thead>
26
<tbody>
15 27
<% for attachment in attachments %>
16 28
<tr>
17 29
  <td>
......
20 32
    <%= link_to_attachment attachment, class: 'icon-only icon-download', title: l(:button_download), download: true -%>
21 33
  </td>
22 34
  <td><%= attachment.description unless attachment.description.blank? %></td>
23
  <td>
24
    <% if options[:author] %>
25
      <span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
26
    <% end %>
27
  </td>
35
  <% if options[:author] %>
36
  <td><span class="author"><%= attachment.author %></span></td>
37
  <td><span class="author"><%= format_time(attachment.created_on) %></span></td>
38
  <% end %>
28 39
  <td>
29 40
    <% if options[:deletable] %>
30 41
      <%= link_to l(:button_delete), attachment_path(attachment),
......
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;}
(3-3/5)