From 65791ce21728f1a854e8360bde0d404986d263ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 11 Jul 2018 08:05:27 +0200 Subject: [PATCH] DMS custom fields an easier way --- after_init.rb | 4 ++ lib/redmine_dmsf.rb | 1 - .../patches/custom_fields_helper_patch.rb | 51 ------------------- 3 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 lib/redmine_dmsf/patches/custom_fields_helper_patch.rb diff --git a/after_init.rb b/after_init.rb index ae2a2468..2fee8cee 100644 --- a/after_init.rb +++ b/after_init.rb @@ -82,6 +82,10 @@ ActionDispatch::Reloader.to_prepare do # Rubyzip configuration Zip.unicode_names = true + # DMS custom fields + CustomFieldsHelper::CUSTOM_FIELDS_TABS << { :name => 'DmsfFileRevisionCustomField', :partial => 'custom_fields/index', + :label => :dmsf } + Redmine::Search.map do |search| search.register :dmsf_files search.register :dmsf_folders diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index ec28985c..70846f5c 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -25,7 +25,6 @@ DMSF_MAX_NOTIFICATION_RECEIVERS_INFO = 10 # DMSF libraries # Plugin's patches -require 'redmine_dmsf/patches/custom_fields_helper_patch' require 'redmine_dmsf/patches/projects_helper_patch' require 'redmine_dmsf/patches/project_patch' require 'redmine_dmsf/patches/user_preference_patch' diff --git a/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb b/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb deleted file mode 100644 index b5d0bb1d..00000000 --- a/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb +++ /dev/null @@ -1,51 +0,0 @@ -# encoding: utf-8 -# -# Redmine plugin for Document Management System "Features" -# -# Copyright © 2011 Vít Jonáš -# Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -module RedmineDmsf - module Patches - module CustomFieldsHelperPatch - - ################################################################################################################## - # Overridden methods - - def render_custom_fields_tabs(types) - 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 - super(types) - end - - def custom_field_type_options - 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 - super - end - - end - end -end - -RedmineExtensions::PatchManager.register_helper_patch 'CustomFieldsHelper', - 'RedmineDmsf::Patches::CustomFieldsHelperPatch', prepend: true \ No newline at end of file