Easy DMSF

This commit is contained in:
Karel Pičman 2024-05-14 12:41:36 +02:00
parent e25fc851cf
commit 0b255a9fc1
22 changed files with 37 additions and 35 deletions

View File

@ -227,4 +227,13 @@ div.autoscroll.dmsf-revision-access {
.dmsf-info-title {
font-weight: bold;
}
/* Also available as */
.other-formats a.csv::before {
content: "" !important;
}
.other-formats a::before {
content: "|" !important;
}

View File

@ -36,7 +36,7 @@ module RedmineDmsf
"\n".html_safe + javascript_include_tag('redmine_dmsf.js', plugin: :redmine_dmsf, defer: true) +
"\n".html_safe + javascript_include_tag('attachments_dmsf.js', plugin: :redmine_dmsf, defer: true)
if defined?(EasyExtensions)
meta << ("\n".html_safe + stylesheet_link_tag('easy_extensions.css', plugin: :redmine_dmsf))
meta << ("\n".html_safe + stylesheet_link_tag('easy_dmsf.css', plugin: :redmine_dmsf))
end
meta
end

View File

@ -81,8 +81,6 @@ module RedmineDmsf
end
def view_issues_show_attachments_table_bottom(context = {})
return if context[:options][:only_mails].blank?
show_attached_documents context[:container], context[:controller], context[:attachments]
end
@ -91,12 +89,10 @@ module RedmineDmsf
end
def view_issues_show_thumbnails(context = {})
show_thumbnails(context[:container], context[:controller]) if context[:options][:only_mails].blank?
show_thumbnails(context[:container], context[:controller])
end
def view_issues_dms_thumbnails(context = {})
return if context[:options][:only_mails].blank?
links = get_links(context[:container])
return unless links.present? && Setting.thumbnails_enabled?

View File

@ -47,7 +47,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
EasyPatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
'RedmineDmsf::Patches::AccessControlPatch',
prepend: true,
first: true

View File

@ -26,10 +26,9 @@ module RedmineDmsf
# Overridden methods
def xapian_link_to_entity(entity, html_options = {})
case entity.is_a?
when DmsfFolder
if entity.is_a?(DmsfFolder)
link_to h(entity.to_s), dmsf_folder_path(id: entity.project_id, folder_id: entity), class: 'icon icon-folder'
when DmsfFile
elsif entity.is_a?(DmsfFile)
link_to h(entity.to_s), dmsf_file_path(id: entity), class: 'icon icon-file'
else
super

View File

@ -36,7 +36,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
EasyPatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
'RedmineDmsf::Patches::AttachablePatch',
prepend: true,
first: true

View File

@ -33,7 +33,7 @@ end
# Apply patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'CustomField', 'RedmineDmsf::Patches::CustomFieldPatch'
EasyPatchManager.register_model_patch 'CustomField', 'RedmineDmsf::Patches::CustomFieldPatch'
else
CustomField.include RedmineDmsf::Patches::CustomFieldPatch
end

View File

@ -158,7 +158,6 @@ module RedmineDmsf
end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'EasyCrmCase', 'RedmineDmsf::Patches::EasyCrmCasePatch',
if: proc { Redmine::Plugin.installed?('easy_crm') }
if Redmine::Plugin.installed?('easy_crm')
EasyPatchManager.register_model_patch 'EasyCrmCase', 'RedmineDmsf::Patches::EasyCrmCasePatch'
end

View File

@ -116,9 +116,8 @@ module RedmineDmsf
end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_controller_patch 'EasyCrmCasesController',
'RedmineDmsf::Patches::EasyCrmCasesControllerPatch',
prepend: true,
if: proc { Redmine::Plugin.installed?('easy_crm') }
if Redmine::Plugin.installed?('easy_crm')
EasyPatchManager.register_controller_patch 'EasyCrmCasesController',
'RedmineDmsf::Patches::EasyCrmCasesControllerPatch',
prepend: true
end

View File

@ -162,7 +162,7 @@ end
# Apply patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'Issue', 'RedmineDmsf::Patches::IssuePatch'
EasyPatchManager.register_model_patch 'Issue', 'RedmineDmsf::Patches::IssuePatch'
else
Issue.prepend RedmineDmsf::Patches::IssuePatch
end

View File

@ -45,4 +45,6 @@ module RedmineDmsf
end
# Apply the patch
Redmine::Notifiable.prepend RedmineDmsf::Patches::NotifiablePatch unless RedmineDmsf::Plugin.an_obsolete_plugin_present?
unless defined?(EasyExtensions) || RedmineDmsf::Plugin.an_obsolete_plugin_present?
Redmine::Notifiable.prepend RedmineDmsf::Patches::NotifiablePatch
end

View File

@ -48,4 +48,6 @@ module RedmineDmsf
end
# Apply the patch
Redmine::Notifiable.include RedmineDmsf::Patches::NotifiableRuPatch if RedmineDmsf::Plugin.an_obsolete_plugin_present?
if !defined?(EasyExtensions) && RedmineDmsf::Plugin.an_obsolete_plugin_present?
Redmine::Notifiable.include RedmineDmsf::Patches::NotifiableRuPatch
end

View File

@ -43,7 +43,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_patch_to_be_first 'Redmine::Export::PDF::ITCPDF',
EasyPatchManager.register_patch_to_be_first 'Redmine::Export::PDF::ITCPDF',
'RedmineDmsf::Patches::PdfPatch',
prepend: true,
first: true

View File

@ -134,7 +134,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'Project', 'RedmineDmsf::Patches::ProjectPatch', prepend: true
EasyPatchManager.register_model_patch 'Project', 'RedmineDmsf::Patches::ProjectPatch', prepend: true
else
Project.prepend RedmineDmsf::Patches::ProjectPatch
end

View File

@ -40,7 +40,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_controller_patch 'QueriesController',
EasyPatchManager.register_controller_patch 'QueriesController',
'RedmineDmsf::Patches::QueriesControllerPatch',
prepend: true
else

View File

@ -42,7 +42,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'Role', 'RedmineDmsf::Patches::RolePatch', prepend: true
EasyPatchManager.register_model_patch 'Role', 'RedmineDmsf::Patches::RolePatch', prepend: true
else
Role.prepend RedmineDmsf::Patches::RolePatch
end

View File

@ -39,7 +39,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?(:easy_extensions)
RedmineExtensions::PatchManager.register_controller_patch 'SearchController',
EasyPatchManager.register_controller_patch 'SearchController',
'RedmineDmsf::Patches::SearchControllerPatch',
prepend: true
end

View File

@ -47,7 +47,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
EasyPatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
'RedmineDmsf::Patches::SearchPatch',
prepend: true,
first: true

View File

@ -64,7 +64,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'User', 'RedmineDmsf::Patches::UserPatch'
EasyPatchManager.register_model_patch 'User', 'RedmineDmsf::Patches::UserPatch'
else
User.prepend RedmineDmsf::Patches::UserPatch
end

View File

@ -60,7 +60,7 @@ end
# Apply the patch
if Redmine::Plugin.installed?('easy_extensions')
RedmineExtensions::PatchManager.register_model_patch 'UserPreference', 'RedmineDmsf::Patches::UserPreferencePatch'
EasyPatchManager.register_model_patch 'UserPreference', 'RedmineDmsf::Patches::UserPreferencePatch'
else
UserPreference.prepend RedmineDmsf::Patches::UserPreferencePatch
end

View File

@ -47,5 +47,3 @@ module XapianEasySearch
end
end
end
XapianEasySearch::DmsfFileMapper.attach if Redmine::Plugin.installed?('easy_extensions')

View File

@ -38,5 +38,3 @@ module XapianEasySearch
end
end
end
XapianEasySearch::DmsfFolderMapper.attach if Redmine::Plugin.installed?('easy_extensions')