<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 %>
}).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);