diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb
index fba1b671..f003ff1d 100644
--- a/app/controllers/dmsf_upload_controller.rb
+++ b/app/controllers/dmsf_upload_controller.rb
@@ -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)
diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb
index d6babffc..f26b2660 100644
--- a/app/views/dmsf_upload/upload_files.html.erb
+++ b/app/views/dmsf_upload/upload_files.html.erb
@@ -27,6 +27,12 @@
<%= render partial: '/dmsf/path',
locals: { folder: @folder, filename: nil, title: l(:heading_uploaded_files) } %>
+<% if @uploads.size > 1 %>
+
+<% end %>
+
<% if (@folder && @folder.description.present?) || @project.dmsf_description.present? %>
<%= 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 %>
@@ -47,3 +53,22 @@
<% 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 %>
diff --git a/assets/stylesheets/redmine_dmsf.css b/assets/stylesheets/redmine_dmsf.css
index c5e86f8d..a47a90dc 100644
--- a/assets/stylesheets/redmine_dmsf.css
+++ b/assets/stylesheets/redmine_dmsf.css
@@ -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%;