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 7911897b..0fba59eb 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) @@ -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. 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/models/dmsf_file_revision_access_query.rb b/app/models/dmsf_file_revision_access_query.rb index 515ce693..5f9fe8a0 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 = {} @@ -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 diff --git a/app/models/dmsf_query.rb b/app/models/dmsf_query.rb index 66f709aa..cbc0a856 100644 --- a/app/models/dmsf_query.rb +++ b/app/models/dmsf_query.rb @@ -135,7 +135,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}\"") 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 @@