diff --git a/assets/images/icons.svg b/assets/images/icons.svg
new file mode 100644
index 0000000..330a00d
--- /dev/null
+++ b/assets/images/icons.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/assets/stylesheets/custom_fields_groups.css b/assets/stylesheets/custom_fields_groups.css
index 839b1cf..fb10b25 100644
--- a/assets/stylesheets/custom_fields_groups.css
+++ b/assets/stylesheets/custom_fields_groups.css
@@ -1,4 +1,4 @@
-#admin-menu a.custom-fields-groups { background-image: url(../images/textfields_group.png);}
+.icon-custom-fields-groups:not(:has(svg)) { background-image: url(../images/textfields_group.png); }
h3.custom-fields-groups {
background: #0001;
diff --git a/config/icon_source.yml b/config/icon_source.yml
new file mode 100644
index 0000000..95245be
--- /dev/null
+++ b/config/icon_source.yml
@@ -0,0 +1,2 @@
+- name: custom-fields-groups
+ svg: list-check
diff --git a/init.rb b/init.rb
index f2236ea..c455939 100644
--- a/init.rb
+++ b/init.rb
@@ -7,9 +7,9 @@
author_url 'https://github.com/georepublic'
url 'https://github.com/gtt-project/redmine_custom_fields_groups'
description 'This is a plugin for grouping custom fields'
- version '1.0.0'
+ version '2.0.0'
- requires_redmine :version_or_higher => '4.1.0'
+ requires_redmine :version_or_higher => '5.0.0'
settings partial: 'settings/redmine_custom_fields_groups',
default: {
@@ -22,23 +22,14 @@
{ controller: 'custom_fields_groups', action: 'index' },
caption: :label_custom_fields_group_plural,
after: :custom_fields,
- html: { class: 'icon icon-custom-fields custom-fields-groups' }
+ html: { class: 'icon icon-custom-fields-groups' },
+ icon: 'custom-fields-groups', plugin: :redmine_custom_fields_groups
end
-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)
- require path
- end
- Rails.application.config.after_initialize do
- RedmineCustomFieldsGroups.setup
- end
-else
- require 'redmine_custom_fields_groups'
- Rails.application.paths["app/overrides"] ||= []
- Rails.application.paths["app/overrides"] << File.expand_path("../app/overrides", __FILE__)
-
- Rails.configuration.to_prepare do
- RedmineCustomFieldsGroups.setup
- end
+Dir.glob("#{Rails.root}/plugins/redmine_custom_fields_groups/app/overrides/**/*.rb").each do |path|
+ Rails.autoloaders.main.ignore(path)
+ require path
+end
+Rails.application.config.after_initialize do
+ RedmineCustomFieldsGroups.setup
end
diff --git a/lib/redmine_custom_fields_groups/patches/issues_helper_patch.rb b/lib/redmine_custom_fields_groups/patches/issues_helper_patch.rb
index 29bcd8f..fc1d211 100644
--- a/lib/redmine_custom_fields_groups/patches/issues_helper_patch.rb
+++ b/lib/redmine_custom_fields_groups/patches/issues_helper_patch.rb
@@ -45,8 +45,10 @@ def render_custom_fields_rows_by_groups(issue)
s << render_full_width_custom_fields_rows_by_grouped_values(issue, values)
else
s << content_tag('fieldset', :class => 'collapsible custom-fields-groups') do
- concat content_tag('legend', title, :onclick => 'toggleFieldset(this);',
- :class => 'icon icon-' + ((Redmine::VERSION.to_s >= '5.0.0') ? 'expanded' : 'expended'))
+ concat content_tag('legend',
+ (Redmine::VERSION.to_s >= '6.0.0') ? sprite_icon('angle-down') + title : title,
+ :onclick => 'toggleFieldset(this);',
+ :class => 'icon icon-expanded')
concat render_half_width_custom_fields_rows_by_grouped_values(issue, values)
concat render_full_width_custom_fields_rows_by_grouped_values(issue, values)
end
diff --git a/test/functional/custom_fields_groups_controller_test.rb b/test/functional/custom_fields_groups_controller_test.rb
index 7dea2ed..ef57e2b 100644
--- a/test/functional/custom_fields_groups_controller_test.rb
+++ b/test/functional/custom_fields_groups_controller_test.rb
@@ -7,6 +7,9 @@ class CustomFieldsGroupsControllerTest < ActionController::TestCase
setup do
User.current = nil
@request.session[:user_id] = 1 # admin
+ if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
+ load_plugin_fixtures(true)
+ end
end
teardown do
diff --git a/test/integration/layout_test.rb b/test/integration/layout_test.rb
index c3a8387..7511ce9 100644
--- a/test/integration/layout_test.rb
+++ b/test/integration/layout_test.rb
@@ -11,6 +11,9 @@ class LayoutTest < Redmine::IntegrationTest
setup do
User.current = nil
@user = User.find_by_login('dlopper')
+ if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
+ load_plugin_fixtures(true)
+ end
end
teardown do
diff --git a/test/system/fieldset_test.rb b/test/system/fieldset_test.rb
index d7b579b..4da6cab 100644
--- a/test/system/fieldset_test.rb
+++ b/test/system/fieldset_test.rb
@@ -8,6 +8,12 @@ class FieldsetTest < ApplicationSystemTestCase
:watchers, :journals, :journal_details,
:custom_fields, :custom_fields_groups, :custom_fields_group_fields
+ setup do
+ if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
+ load_plugin_fixtures(true)
+ end
+ end
+
teardown do
Setting.where(name: 'plugin_redmine_custom_fields_groups').destroy_all
Setting.clear_cache
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 99aca5d..c9d04f8 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,7 +1,14 @@
# Load the Redmine helper
require_relative '../../../test/test_helper'
-ActiveRecord::FixtureSet.create_fixtures(
- File.dirname(__FILE__) + '/fixtures',
- ['custom_fields_groups', 'custom_fields_group_fields']
-)
+def load_plugin_fixtures(reset_cache = false)
+ if reset_cache
+ ActiveRecord::FixtureSet.reset_cache
+ end
+ ActiveRecord::FixtureSet.create_fixtures(
+ File.dirname(__FILE__) + '/fixtures',
+ ['custom_fields_groups', 'custom_fields_group_fields']
+ )
+end
+
+load_plugin_fixtures
diff --git a/test/unit/custom_fields_group_test.rb b/test/unit/custom_fields_group_test.rb
index ea85586..61d2dd0 100644
--- a/test/unit/custom_fields_group_test.rb
+++ b/test/unit/custom_fields_group_test.rb
@@ -3,6 +3,12 @@
class CustomFieldsGroupTest < ActiveSupport::TestCase
fixtures :custom_fields, :custom_fields_groups, :custom_fields_group_fields
+ setup do
+ if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
+ load_plugin_fixtures(true)
+ end
+ end
+
test 'create' do
issue_custom_field = IssueCustomField.new(:name => 'test', :field_format => 'text')
issue_custom_field.save!