From e6413454e0cc76383b4cd7db6b4ffb6cb8bb781d Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Mon, 22 Jun 2020 10:07:44 +0200 Subject: [PATCH 1/7] Edit must be enabled if the document is unlockable --- app/views/dmsf_context_menus/_file.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/dmsf_context_menus/_file.html.erb b/app/views/dmsf_context_menus/_file.html.erb index f94169d8..5cf5c158 100644 --- a/app/views/dmsf_context_menus/_file.html.erb +++ b/app/views/dmsf_context_menus/_file.html.erb @@ -22,7 +22,7 @@
  • <%= context_menu_link l(:button_edit), dmsf_file_path(id: dmsf_file), class: 'icon icon-edit', - disabled: !allowed || locked %> + disabled: !allowed || (locked && !unlockable) %>
  • <%= link_to "#{l(:button_copy)}/#{l(:button_move)}", copy_file_path(id: dmsf_file), From 35b048df2653258c38d997509360422e245aa1e9 Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Mon, 22 Jun 2020 10:40:24 +0200 Subject: [PATCH 2/7] Title shows up in 'order by' clause multiple times #1138 --- app/models/dmsf_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/dmsf_query.rb b/app/models/dmsf_query.rb index 963679dd..3db5acd8 100644 --- a/app/models/dmsf_query.rb +++ b/app/models/dmsf_query.rb @@ -132,7 +132,7 @@ class DmsfQuery < Query # New def dmsf_nodes(options={}) - order_option = ['sort', group_by_sort_order, (options[:order] || sort_clause[0]), 'title'].flatten.reject(&:blank?) + order_option = ['sort', group_by_sort_order, (options[:order] || sort_clause[0])].flatten.reject(&:blank?) if order_option.size > 2 DmsfFileRevisionCustomField.visible.pluck(:id, :name).each do |id, name| order_option[1].gsub!("COALESCE(cf_#{id}.value, '')", "\"#{name}\"") From 77edf02671bc5a04ca5d6afed46dab4778f44f87 Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Mon, 22 Jun 2020 13:54:21 +0200 Subject: [PATCH 3/7] Migration 2.4.2 -> 2020-06-17 commits: Error 500 when attempting to modify a document #1139 --- app/models/dmsf_file_revision_access_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/dmsf_file_revision_access_query.rb b/app/models/dmsf_file_revision_access_query.rb index 515ce693..49174b92 100644 --- a/app/models/dmsf_file_revision_access_query.rb +++ b/app/models/dmsf_file_revision_access_query.rb @@ -35,7 +35,7 @@ class DmsfFileRevisionAccessQuery < Query QueryColumn.new(:last_at, frozen: true) ] - def initialize(attributes) + def initialize(attributes=nil, *args) super attributes self.sort_criteria = [] self.filters = {} From dc165f0a28a9efe7c012812ec706165337a9d209 Mon Sep 17 00:00:00 2001 From: pavel Date: Tue, 23 Jun 2020 18:54:19 +0200 Subject: [PATCH 4/7] restore minimum Redmine version to 4.0 --- .travis.yml | 3 +++ README.md | 4 ++-- init.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 012dc77d..47f092e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,9 @@ after_script: - bash -x ./test/ci/redmine_install.sh -u env: + - DB=sqlite REDMINE_GIT_TAG=4.0-stable + - DB=mysql REDMINE_GIT_TAG=4.0-stable + - DB=postgres REDMINE_GIT_TAG=4.0-stable - DB=sqlite REDMINE_GIT_TAG=4.1-stable - DB=mysql REDMINE_GIT_TAG=4.1-stable - DB=postgres REDMINE_GIT_TAG=4.1-stable diff --git a/README.md b/README.md index 9f14c2bd..6f411133 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,12 @@ Features * Documents and folders symbolic links * Trash bin * Documents attachable to issues - * Compatible with Redmine 4.1.x + * Compatible with Redmine 4.0.x and 4.1.x Dependencies ------------ - * Redmine 4.1.0 or higher + * Redmine 4.0.0 or higher ### Full-text search (optional) diff --git a/init.rb b/init.rb index c3ae7d8a..c329ec42 100644 --- a/init.rb +++ b/init.rb @@ -35,7 +35,7 @@ Redmine::Plugin.register :redmine_dmsf do description 'Document Management System Features' version '2.4.3' - requires_redmine version_or_higher: '4.1.0' + requires_redmine version_or_higher: '4.0.0' settings partial: 'settings/dmsf_settings', default: { From 52fbc8dea6be6fc1669515b1e5b5651a5e6550ad Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Wed, 24 Jun 2020 10:30:52 +0200 Subject: [PATCH 5/7] #1131 Wrong plugins migration command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f411133..eac0c981 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ You can either clone the master branch or download the latest zipped version. Be `RAILS_ENV=production bundle exec rake db:migrate` - `RAILS_ENV=production bundle exec rake plugins:migrate NAME=redmine_dmsf` + `RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf` 5. The access rights must be set for web server, example: `chown -R www-data:www-data plugins/redmine_dmsf`. 6. Restart the web server, e.g. `systemctl apache2 restart` 7. You should configure the plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure. From 1c220b7e66a8882fe7f74a1e3ae994b938a2bb84 Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Wed, 24 Jun 2020 10:46:28 +0200 Subject: [PATCH 6/7] New Error 500 when attempting to modify a document #1140 --- app/models/dmsf_file_revision_access_query.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/dmsf_file_revision_access_query.rb b/app/models/dmsf_file_revision_access_query.rb index 49174b92..5f9fe8a0 100644 --- a/app/models/dmsf_file_revision_access_query.rb +++ b/app/models/dmsf_file_revision_access_query.rb @@ -73,8 +73,6 @@ class DmsfFileRevisionAccessQuery < Query @available_columns end - #alias default_columns_names available_columns - ###################################################################################################################### # New @@ -82,7 +80,7 @@ class DmsfFileRevisionAccessQuery < Query base_scope. access_grouped. joins(:user). - order('`count` DESC'). + order(Arel.sql('COUNT(*) DESC')). limit(options[:limit]). offset(options[:offset]) end From 5cf19e85f6bc829d18813e4f1341cfff7c7fb31a Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Wed, 24 Jun 2020 13:30:51 +0200 Subject: [PATCH 7/7] Wrong pagination of document's revisions --- app/controllers/dmsf_files_controller.rb | 3 ++- app/views/dmsf_files/_revision_access.html.erb | 1 - app/views/dmsf_files/show.html.erb | 10 ++-------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index a988bc09..b12e138a 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -85,7 +85,8 @@ class DmsfFilesController < ApplicationController @revision = @file.last_revision @file_delete_allowed = User.current.allowed_to?(:file_delete, @project) @file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project) - @revision_pages = Paginator.new @file.dmsf_file_revisions.visible.count, params['per_page'] ? params['per_page'].to_i : 25, params['page'] + @revision_count = @file.dmsf_file_revisions.visible.all.size + @revision_pages = Paginator.new @revision_count, params['per_page'] ? params['per_page'].to_i : 25, params['page'] respond_to do |format| format.html { diff --git a/app/views/dmsf_files/_revision_access.html.erb b/app/views/dmsf_files/_revision_access.html.erb index 937297cf..92bcbe5f 100644 --- a/app/views/dmsf_files/_revision_access.html.erb +++ b/app/views/dmsf_files/_revision_access.html.erb @@ -44,4 +44,3 @@ -<%= pagination_links_full revision_access_pages, revision_access_count %> diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index e0e7a9d5..4ace6ff5 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -158,20 +158,14 @@ <% if @file_manipulation_allowed %> <% revision_access_query = DmsfFileRevisionAccessQuery.new %> <% revision_access_query.revision_id = revision.id %> - <% revision_access_count = revision_access_query.access_count %> - <% revision_access_pages = Redmine::Pagination::Paginator.new revision_access_count, - Setting.per_page_options_array.first || 25, params['page'] %> - <%= render partial: 'revision_access', locals: { revision: revision, query: revision_access_query, - revision_access_count: revision_access_count, - revision_access_pages: revision_access_pages } %> + <%= render partial: 'revision_access', locals: { revision: revision, query: revision_access_query } %> <% end %>
    <% end %> - -<%= pagination_links_full @revision_pages, @file.dmsf_file_revisions.visible.count %> +<%= pagination_links_full @revision_pages, @revision_count %> <%= late_javascript_tag do %> $('a.delete-revision').click(function(event) {