Patch #29395 » 0004-Let-pagination-always-be-visible.patch
| app/views/layouts/_file.html.erb | ||
|---|---|---|
| 10 | 10 |
<p><%= "#{@attachment.description} - " unless @attachment.description.blank? %>
|
| 11 | 11 |
<span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p> |
| 12 | 12 |
</div> |
| 13 |
<%= yield %> |
|
| 13 |
<div class="filecontent-container"> |
|
| 14 |
<%= yield %> |
|
| 15 |
</div> |
|
| 14 | 16 | |
| 15 | 17 |
<span class="pagination filepreview"> |
| 16 | 18 |
<%= render_pagination %> |
| public/javascripts/application.js | ||
|---|---|---|
| 892 | 892 |
}).change(); |
| 893 | 893 |
}); |
| 894 | 894 | |
| 895 |
function setFilecontentContainerHeight() {
|
|
| 896 |
var $filecontainer = $('.filecontent-container');
|
|
| 897 |
var fileTypeSelectors = ['.image', 'video']; |
|
| 898 |
|
|
| 899 |
if($filecontainer.length > 0 && $filecontainer.find(fileTypeSelectors.join(',')).length === 1) {
|
|
| 900 |
var containerOffsetTop = $filecontainer.offset().top; |
|
| 901 |
var containerMarginBottom = parseInt($filecontainer.css('marginBottom'));
|
|
| 902 |
var paginationHeight = $filecontainer.next('.pagination').height();
|
|
| 903 |
var diff = containerOffsetTop + containerMarginBottom + paginationHeight; |
|
| 904 | ||
| 905 |
$filecontainer.css('height', 'calc(100vh - ' + diff + 'px)')
|
|
| 906 |
} |
|
| 907 |
} |
|
| 908 | ||
| 909 |
function setupAttachmentDetail() {
|
|
| 910 |
setFilecontentContainerHeight(); |
|
| 911 |
$(window).resize(setFilecontentContainerHeight); |
|
| 912 |
} |
|
| 913 | ||
| 895 | 914 |
$(document).ready(setupAjaxIndicator); |
| 896 | 915 |
$(document).ready(hideOnLoad); |
| 897 | 916 |
$(document).ready(addFormObserversForDoubleSubmit); |
| 898 | 917 |
$(document).ready(defaultFocus); |
| 918 |
$(document).ready(setupAttachmentDetail); |
|
| 899 | 919 |
$(document).ready(setupTabs); |
| public/stylesheets/application.css | ||
|---|---|---|
| 1521 | 1521 |
img {
|
| 1522 | 1522 |
image-orientation: from-image; |
| 1523 | 1523 |
} |
| 1524 | ||
| 1525 |
.filecontent-container {
|
|
| 1526 |
position: relative; |
|
| 1527 |
margin-bottom: 20px; |
|
| 1528 |
min-height: 200px; |
|
| 1529 |
} |
|
| 1530 |
.filecontent-container > .filecontent {
|
|
| 1531 |
position: absolute; |
|
| 1532 |
max-height: 100%; |
|
| 1533 |
max-width: 100%; |
|
| 1534 |
} |
|