diff --git a/README.md b/README.md index f949f9c8..3e020e54 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,12 @@ Features * Documents and folders symbolic links * Document tagging * Trash bin - * Compatible with Redmine 2.6.x + * Compatible with Redmine 3.x.x Dependencies ------------ - * Redmine 2.3.2 or higher + * Redmine 2.5.0 or higher ### Fulltext search (optional) diff --git a/init.rb b/init.rb index 57c3fcbb..b46f4da0 100644 --- a/init.rb +++ b/init.rb @@ -32,7 +32,7 @@ Redmine::Plugin.register :redmine_dmsf do url 'http://www.redmine.org/plugins/dmsf' author_url 'https://github.com/danmunn/redmine_dmsf/graphs/contributors' - requires_redmine :version_or_higher => '2.3.0' + requires_redmine :version_or_higher => '2.5.0' settings :partial => 'settings/dmsf_settings', :default => { diff --git a/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb b/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb index fadce7ce..1b66980f 100644 --- a/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb +++ b/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb @@ -2,7 +2,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-14 Karel Picman +# Copyright (C) 2011-15 Karel Picman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -28,27 +28,16 @@ module RedmineDmsf base.send(:include, InstanceMethods) base.class_eval do unloadable - if ( - (Redmine::VERSION::MAJOR >= 3) || - (Redmine::VERSION::MAJOR >= 2 && Redmine::VERSION::MINOR >= 5) - ) - alias_method_chain :render_custom_fields_tabs, :render_custom_tab - alias_method_chain :custom_field_type_options, :custom_tab_options - else - alias_method_chain :custom_fields_tabs, :custom_tab - end + + alias_method_chain :render_custom_fields_tabs, :render_custom_tab + alias_method_chain :custom_field_type_options, :custom_tab_options end end module ClassMethods end - module InstanceMethods - - def custom_fields_tabs_with_custom_tab - add_cf - custom_fields_tabs_without_custom_tab - end + module InstanceMethods def render_custom_fields_tabs_with_render_custom_tab(types) add_cf @@ -63,28 +52,20 @@ module RedmineDmsf private def add_cf - cf = {:name => 'DmsfFileRevisionCustomField', :partial => 'custom_fields/index', :label => :dmsf} - if ( - (Redmine::VERSION::MAJOR >= 3) || - (Redmine::VERSION::MAJOR >= 2 && Redmine::VERSION::MINOR >= 5) - ) - unless CustomFieldsHelper::CUSTOM_FIELDS_TABS.index { |f| f[:name] == cf[:name] } - CustomFieldsHelper::CUSTOM_FIELDS_TABS << cf - else - unless CustomField::CUSTOM_FIELDS_TABS.index { |f| f[:name] == cf[:name] } - CustomField::CUSTOM_FIELDS_TABS << cf - end - end + cf = {:name => 'DmsfFileRevisionCustomField', :partial => 'custom_fields/index', :label => :dmsf} + unless CustomFieldsHelper::CUSTOM_FIELDS_TABS.index { |f| f[:name] == cf[:name] } + CustomFieldsHelper::CUSTOM_FIELDS_TABS << cf end end + end end end end -# Apply patch +# Apply the patch Rails.configuration.to_prepare do unless CustomFieldsHelper.included_modules.include?(RedmineDmsf::Patches::CustomFieldsHelperPatch) CustomFieldsHelper.send(:include, RedmineDmsf::Patches::CustomFieldsHelperPatch) end -end +end \ No newline at end of file