diff --git a/CHANGELOG.md b/CHANGELOG.md index 601dab51..b59a1118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,21 @@ Changelog for Redmine DMSF ========================== -3.0.13 ????-??-?? +3.0.13 *????-??-??* ------------------ An option to disable the original module Documents in the plugin's settings + Documents preview available if the binary is available but not explicitly defined in the plugin's settings + Rubocop tests of the plugin's source codes -3.0.12 2023-03-15 +3.0.12 *2023-03-15* ------------------ Bug fixing * Bug: #1436 - Cannot upload new content -3.0.11 2023-03-14 +3.0.11 *2023-03-14* ------------------ Bug fixing diff --git a/app/controllers/dmsf_context_menus_controller.rb b/app/controllers/dmsf_context_menus_controller.rb index 00f93122..8e4489ab 100644 --- a/app/controllers/dmsf_context_menus_controller.rb +++ b/app/controllers/dmsf_context_menus_controller.rb @@ -37,6 +37,7 @@ class DmsfContextMenusController < ApplicationController @unlockable = @allowed && @dmsf_file.unlockable? && (!@dmsf_file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)) @email_allowed = User.current.allowed_to?(:email_documents, @project) + @preview = RedmineDmsf::Preview.office_available? && Setting.plugin_redmine_dmsf['office_bin'].blank? elsif @dmsf_folder @locked = @dmsf_folder.locked? @project = @dmsf_folder.project diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index 30235d3a..057c264b 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -77,7 +77,7 @@ class DmsfFilesController < ApplicationController expires_in 0.years, 'must-revalidate' => true pdf_preview = (params[:disposition] != 'attachment') && params[:filename].blank? && @file.pdf_preview filename = filename_for_content_disposition(@revision.formatted_name(member)) - if pdf_preview.present? + if pdf_preview.present? && (Setting.plugin_redmine_dmsf['office_bin'].present? || params[:preview].present?) basename = File.basename(filename, '.*') send_file pdf_preview, filename: "#{basename}.pdf", type: 'application/pdf', disposition: 'inline' else diff --git a/app/views/dmsf_context_menus/_file.html.erb b/app/views/dmsf_context_menus/_file.html.erb index dc853294..3f995ead 100644 --- a/app/views/dmsf_context_menus/_file.html.erb +++ b/app/views/dmsf_context_menus/_file.html.erb @@ -87,6 +87,12 @@