]> source.dussan.org Git - redmine.git/commitdiff
Let pagination always be visible (#29395).
authorGo MAEDA <maeda@farend.jp>
Thu, 4 Oct 2018 13:31:14 +0000 (13:31 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 4 Oct 2018 13:31:14 +0000 (13:31 +0000)
Patch by Felix Gliesche.

git-svn-id: http://svn.redmine.org/redmine/trunk@17570 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/layouts/_file.html.erb
public/javascripts/application.js
public/stylesheets/application.css

index 5c1478b9c78a3078f92cb330cff1a83283ec86ae..4a17bacd762e712413e70fa10d0c5f0a423f8b41 100644 (file)
@@ -10,7 +10,9 @@
 <p><%= "#{@attachment.description} - " unless @attachment.description.blank? %>
    <span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
 </div>
-<%= yield %>
+<div class="filecontent-container">
+  <%= yield %>
+</div>
 
 <span class="pagination filepreview">
   <%= render_pagination %>
index 76f65bf4c1c61738f50ccfc104545dba7ac6920b..75848dd2cccd3459d59bd1e23f0be35b67ae8ae2 100644 (file)
@@ -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);
index 8a33fda3a458ffae53adb55304be1d2d4b7b6da4..1d75ca87d86ef9294c3288e3471368b94a1286c1 100644 (file)
@@ -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%;
+}