From b649420d771b978832cd4f2a32a12ce3c0275774 Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Thu, 8 Aug 2024 20:15:53 +0900 Subject: [PATCH 1/5] Move deface override file to method level file --- app/overrides/{issues.rb => issues/new.rb} | 0 init.rb | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename app/overrides/{issues.rb => issues/new.rb} (100%) diff --git a/app/overrides/issues.rb b/app/overrides/issues/new.rb similarity index 100% rename from app/overrides/issues.rb rename to app/overrides/issues/new.rb diff --git a/init.rb b/init.rb index 65956cc..1d7dff2 100644 --- a/init.rb +++ b/init.rb @@ -26,7 +26,7 @@ end if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled? - require_relative 'app/overrides/issues' + require_relative 'app/overrides/issues/new' Rails.application.config.after_initialize do RedmineCustomFieldsGroups.setup end From a83e38258f31f13a2f934175a3a688f0f51cc40a Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Thu, 8 Aug 2024 20:16:47 +0900 Subject: [PATCH 2/5] Remove module wrap for deface override file --- app/overrides/issues/new.rb | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/app/overrides/issues/new.rb b/app/overrides/issues/new.rb index 867b0a1..fbfc5ee 100644 --- a/app/overrides/issues/new.rb +++ b/app/overrides/issues/new.rb @@ -1,16 +1,14 @@ -module Issues - Deface::Override.new( - :virtual_path => "issues/show", - :name => "deface_replace_render_half_width_custom_fields_rows", - :replace => "erb[loud]:contains('render_half_width_custom_fields_rows(@issue)')", - :original => "<%= render_half_width_custom_fields_rows(@issue) %>", - :text => "<%= render_custom_fields_rows_by_groups(@issue) %>" - ) +Deface::Override.new( + :virtual_path => "issues/show", + :name => "deface_replace_render_half_width_custom_fields_rows", + :replace => "erb[loud]:contains('render_half_width_custom_fields_rows(@issue)')", + :original => "<%= render_half_width_custom_fields_rows(@issue) %>", + :text => "<%= render_custom_fields_rows_by_groups(@issue) %>" +) - Deface::Override.new( - :virtual_path => "issues/show", - :name => "deface_remove_render_full_width_custom_fields_rows", - :remove => "erb[loud]:contains('render_full_width_custom_fields_rows(@issue)')", - :original => "<%= render_full_width_custom_fields_rows(@issue) %>" - ) -end +Deface::Override.new( + :virtual_path => "issues/show", + :name => "deface_remove_render_full_width_custom_fields_rows", + :remove => "erb[loud]:contains('render_full_width_custom_fields_rows(@issue)')", + :original => "<%= render_full_width_custom_fields_rows(@issue) %>" +) From 4d0c3ee9b652b3486fdd5cc20d87d6cd6a11100b Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Thu, 8 Aug 2024 21:41:52 +0900 Subject: [PATCH 3/5] Fix new to show --- app/overrides/issues/{new.rb => show.rb} | 0 init.rb | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename app/overrides/issues/{new.rb => show.rb} (100%) diff --git a/app/overrides/issues/new.rb b/app/overrides/issues/show.rb similarity index 100% rename from app/overrides/issues/new.rb rename to app/overrides/issues/show.rb diff --git a/init.rb b/init.rb index 1d7dff2..45f8b17 100644 --- a/init.rb +++ b/init.rb @@ -26,7 +26,7 @@ end if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled? - require_relative 'app/overrides/issues/new' + require_relative 'app/overrides/issues/show' Rails.application.config.after_initialize do RedmineCustomFieldsGroups.setup end From b9dc750a22dccfe6f9ab56ef54e94db3a0e50f1e Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Thu, 8 Aug 2024 21:45:42 +0900 Subject: [PATCH 4/5] Apply redmine_base_deface init.rb changes --- init.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 45f8b17..1da8c57 100644 --- a/init.rb +++ b/init.rb @@ -26,7 +26,10 @@ end if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled? - require_relative 'app/overrides/issues/show' + Dir.glob("#{Rails.root}/plugins/redmine_custom_fields_groups/app/overrides/**/*.rb").each do |path| + Rails.autoloaders.main.ignore(path) + load File.expand_path(path, __FILE__) + end Rails.application.config.after_initialize do RedmineCustomFieldsGroups.setup end From fb3872341e443424540759fc3ff467e1f1b70851 Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Fri, 9 Aug 2024 14:08:47 +0900 Subject: [PATCH 5/5] Use require instead of load to avoid reload issue --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 1da8c57..f2236ea 100644 --- a/init.rb +++ b/init.rb @@ -28,7 +28,7 @@ if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled? Dir.glob("#{Rails.root}/plugins/redmine_custom_fields_groups/app/overrides/**/*.rb").each do |path| Rails.autoloaders.main.ignore(path) - load File.expand_path(path, __FILE__) + require path end Rails.application.config.after_initialize do RedmineCustomFieldsGroups.setup