#1195 Move to the bottom button

This commit is contained in:
karel.picman@lbcfree.net 2020-12-21 15:44:29 +01:00
parent b396844bec
commit b16414c1f4
3 changed files with 52 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class DmsfUploadController < ApplicationController
@attachment.skip_description_required = true
end
begin
Attachment.skip_callback(:commit, :after, :reuse_existing_file_if_possible)
Attachment.skip_callback(:commit, :after, :reuse_existing_file_if_possible, raise: false)
saved = @attachment.save
ensure
Attachment.set_callback(:commit, :after, :reuse_existing_file_if_possible)

View File

@ -27,6 +27,12 @@
<%= render partial: '/dmsf/path',
locals: { folder: @folder, filename: nil, title: l(:heading_uploaded_files) } %>
<% if @uploads.size > 1 %>
<div class="dmsf-scroll">
<a class="dmsf-scroll-down" href="#footer"><%= l(:label_scroll_down) %></a>
</div>
<% end %>
<% if (@folder && @folder.description.present?) || @project.dmsf_description.present? %>
<div class="wiki">
<%= textilizable(@folder ? @folder.description : @project.dmsf_description) %>
@ -39,7 +45,7 @@
<% if upload.locked %>
<%= render partial: 'upload_file_locked', locals: { upload: upload, i: i } %>
<% else %>
<%= render partial: 'upload_file', locals: { upload: upload, i: i, wiki: @wiki } %>
<%= render partial: 'upload_file', locals: { upload: upload, i: i, wiki: @wiki, n: @uploads.size } %>
<% end %>
<% end %>
<div class="form-actions">
@ -47,3 +53,22 @@
</div>
<% end %>
<% end %>
<%= late_javascript_tag do %>
// When the user scrolls the page, execute scrollFunction
window.onscroll = function() {
scrollFunction()
};
var scroller = $(".dmsf-scroll");
var firstUploadBox = $(".dmfs-box-tabular:first");
var offset = firstUploadBox.offset();
// Add the sticky class to the header when you reach its scroll position.
// Remove "sticky" when you leave the scroll position
function scrollFunction() {
if (window.pageYOffset > offset.top) {
scroller.addClass("dmsf-sticky");
} else {
scroller.removeClass("dmsf-sticky");
}
}
<% end %>

View File

@ -327,6 +327,31 @@ div[id*="revision_access_"] {
padding-top: 10px
}
a.dmsf-scroll-down {
background: url(../../../images/arrow_down.png) no-repeat 5px 50%;
background-color: #759FCF;
text-decoration: none;
color: #FFFFFF;
font-weight: bold;
font-size: 0.8em;
float: right;
padding: 2px 9px 3px 20px;
margin-right: 20px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
div.dmsf-sticky {
position: fixed;
right: 10px;
top: 0;
z-index: 10000;
}
div.dmsf-scroll {
width: 100%;
}
/* New link form */
#dmsf_link_target_file_id, #dmsf_link_target_folder_id, #dmsf_link_target_project_id, #dmsf_link_name{
min-width: 40%;