From: Go MAEDA Date: Thu, 4 Oct 2018 13:31:14 +0000 (+0000) Subject: Let pagination always be visible (#29395). X-Git-Tag: 4.0.0~108 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=00311c574e1419116166789820ae23b31acbfa5a;p=redmine.git Let pagination always be visible (#29395). Patch by Felix Gliesche. git-svn-id: http://svn.redmine.org/redmine/trunk@17570 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/layouts/_file.html.erb b/app/views/layouts/_file.html.erb index 5c1478b9c..4a17bacd7 100644 --- a/app/views/layouts/_file.html.erb +++ b/app/views/layouts/_file.html.erb @@ -10,7 +10,9 @@

<%= "#{@attachment.description} - " unless @attachment.description.blank? %> <%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %>

-<%= yield %> +
+ <%= yield %> +
<%= render_pagination %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 76f65bf4c..75848dd2c 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -904,9 +904,29 @@ $(function ($) { }).change(); }); +function setFilecontentContainerHeight() { + var $filecontainer = $('.filecontent-container'); + var fileTypeSelectors = ['.image', 'video']; + + if($filecontainer.length > 0 && $filecontainer.find(fileTypeSelectors.join(',')).length === 1) { + var containerOffsetTop = $filecontainer.offset().top; + var containerMarginBottom = parseInt($filecontainer.css('marginBottom')); + var paginationHeight = $filecontainer.next('.pagination').height(); + var diff = containerOffsetTop + containerMarginBottom + paginationHeight; + + $filecontainer.css('height', 'calc(100vh - ' + diff + 'px)') + } +} + +function setupAttachmentDetail() { + setFilecontentContainerHeight(); + $(window).resize(setFilecontentContainerHeight); +} + $(document).ready(setupAjaxIndicator); $(document).ready(hideOnLoad); $(document).ready(addFormObserversForDoubleSubmit); $(document).ready(defaultFocus); +$(document).ready(setupAttachmentDetail); $(document).ready(setupTabs); $(document).ready(setupFilePreviewNavigation); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 8a33fda3a..1d75ca87d 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1507,3 +1507,14 @@ img.filecontent.image {background-image: url(../images/transparent.png);} img { image-orientation: from-image; } + +.filecontent-container { + position: relative; + margin-bottom: 20px; + min-height: 200px; +} +.filecontent-container > .filecontent { + position: absolute; + max-height: 100%; + max-width: 100%; +}