DMS attachments fix
This commit is contained in:
parent
99e1135599
commit
cfa997c8b8
@ -25,7 +25,7 @@ module RedmineDmsf
|
||||
class DmsfViewListener < Redmine::Hook::ViewListener
|
||||
|
||||
def view_layouts_base_html_head(context={})
|
||||
return unless /^(Dmsf|Projects)/.match?(context[:controller].class.name)
|
||||
return unless /^(Dmsf|Projects|Issues)/.match?(context[:controller].class.name)
|
||||
meta = "\n".html_safe + stylesheet_link_tag('redmine_dmsf.css', plugin: :redmine_dmsf) +
|
||||
"\n".html_safe + stylesheet_link_tag('select2.min.css', plugin: :redmine_dmsf) +
|
||||
"\n".html_safe + javascript_include_tag('select2.min.js', plugin: :redmine_dmsf, defer: true) +
|
||||
|
||||
@ -36,7 +36,7 @@ module RedmineDmsf
|
||||
description = defined?(EasyExtensions) && EasySetting.value('attachment_description')
|
||||
# Radio buttons
|
||||
if allowed_to_attach_documents(container) && allowed_to_attach_attachments(container)
|
||||
html << (description ? '<p' : '<div')
|
||||
html << (description ? '<p>' : '<div>')
|
||||
classes = +'inline'
|
||||
html << "<label class=\"#{classes}\">"
|
||||
html << radio_button_tag('dmsf_attachments_upload_choice', 'Attachments',
|
||||
@ -119,9 +119,12 @@ module RedmineDmsf
|
||||
|
||||
def allowed_to_attach_attachments(container)
|
||||
unless defined?(EasyExtensions)
|
||||
true
|
||||
return true
|
||||
end
|
||||
container && container.project && container.project.module_enabled?(:documents)
|
||||
if allowed_to_attach_documents(container) && (!container.project.module_enabled?(:documents))
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def get_links(container)
|
||||
|
||||
@ -160,11 +160,12 @@ module RedmineDmsf
|
||||
|
||||
# Adds a journal detail for an attachment that was added or removed
|
||||
def journalize_dmsf_file(dmsf_file, added_or_removed)
|
||||
key = (added_or_removed == :removed ? :old_value : :value)
|
||||
init_journal(User.current)
|
||||
current_journal.details << JournalDetail.new(
|
||||
property: 'dmsf_file',
|
||||
prop_key: dmsf_file.id,
|
||||
key: dmsf_file.title
|
||||
key => dmsf_file.title
|
||||
)
|
||||
current_journal.save
|
||||
end
|
||||
|
||||
@ -163,11 +163,12 @@ module RedmineDmsf
|
||||
|
||||
# Adds a journal detail for an attachment that was added or removed
|
||||
def journalize_dmsf_file(dmsf_file, added_or_removed)
|
||||
key = (added_or_removed == :removed ? :old_value : :value)
|
||||
init_journal(User.current)
|
||||
current_journal.details << JournalDetail.new(
|
||||
property: 'dmsf_file',
|
||||
prop_key: dmsf_file.id,
|
||||
key: dmsf_file.title
|
||||
key => dmsf_file.title
|
||||
)
|
||||
current_journal.save
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user