diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 25d022029..1d5a11d02 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -12,8 +12,19 @@ ) if attachments.size > 1 %> -<% for attachment in attachments %> + + + + + + + + + +<% attachments.each_with_index do |attachment, index| %> + + <% end %> +
#<%= l(:field_name) %><%= l(:field_description) %>
<%= index + 1 %> <%= link_to_attachment attachment, class: 'icon icon-attachment' -%> (<%= number_to_human_size attachment.filesize %>) @@ -36,6 +47,7 @@
<% if defined?(thumbnails) && thumbnails %> <% images = attachments.select(&:thumbnailable?) %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 1bc228236..f44467fdc 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1096,8 +1096,8 @@ function setupAttachmentDetail() { $(window).resize(setFilecontentContainerHeight); } -function setupWikiTableSortableHeader() { - $('div.wiki table').each(function(i, table){ +function setupTableSortableHeader(selector) { + $(selector).each(function(i, table){ if (table.rows.length < 3) return true; var tr = $(table.rows).first(); if (tr.find("TH").length > 0) { @@ -1108,6 +1108,14 @@ function setupWikiTableSortableHeader() { }); } +function setupWikiTableSortableHeader() { + setupTableSortableHeader('div.wiki table'); +} + +function setupAttachmentsTableSortableHeader() { + setupTableSortableHeader('div.attachments table'); +} + $(function () { $("[title]:not(.no-tooltip)").tooltip({ show: { @@ -1209,6 +1217,7 @@ $(document).ready(setupAttachmentDetail); $(document).ready(setupTabs); $(document).ready(setupFilePreviewNavigation); $(document).ready(setupWikiTableSortableHeader); +$(document).ready(setupAttachmentsTableSortableHeader); $(document).on('focus', '[data-auto-complete=true]', function(event) { inlineAutoComplete(event.target); }); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index fca5f5647..c2dfa8eae 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -938,6 +938,8 @@ div.fileover, p.custom-field-filedroplistner.fileover { background-color: lavend div.attachments p { margin:4px 0 2px 0; } div.attachments img { vertical-align: middle; } div.attachments span.author { font-size: 0.9em; color: #888; } +div.attachments table { border-collapse:collapse; } +div.attachments table thead { border-bottom:1px solid #ccc; } div.thumbnails {margin:0.6em;} div.thumbnails div {background:#fff;border:2px solid #ddd;display:inline-block;margin-right:2px;}