Skip to content

Commit c0db3b3

Browse files
authored
Merge pull request #39 from sanak/ftr/support-6
Support Redmine 6.0 and drop Redmine 4.2
2 parents c3af621 + a0687ef commit c0db3b3

File tree

13 files changed

+83
-49
lines changed

13 files changed

+83
-49
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,32 @@ on:
1717
jobs:
1818
test:
1919
name: redmine:${{ matrix.redmine_version }} ruby:${{ matrix.ruby_version }} db:${{ matrix.db }}
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-24.04
2121

2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
redmine_version: [4.2-stable, 5.0-stable, 5.1-stable, master]
26-
ruby_version: ['2.7', '3.0', '3.1', '3.2']
25+
redmine_version: [5.0-stable, 5.1-stable, 6.0-stable, master]
26+
ruby_version: ['3.1', '3.2', '3.3']
2727
db: ['mysql:5.7', 'postgres:10', 'sqlite3']
2828
# System test takes 2~3 times longer, so limit to specific matrix combinations
2929
# See: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
3030
include:
3131
- system_test: true
32-
redmine_version: 5.1-stable
33-
ruby_version: '3.2'
32+
redmine_version: 6.0-stable
33+
ruby_version: '3.3'
3434
db: 'mysql:5.7'
3535
exclude:
36-
- redmine_version: 4.2-stable
37-
ruby_version: '3.0'
38-
- redmine_version: 4.2-stable
39-
ruby_version: '3.1'
40-
- redmine_version: 4.2-stable
41-
ruby_version: '3.2'
4236
- redmine_version: 5.0-stable
4337
ruby_version: '3.2'
44-
- redmine_version: master
45-
ruby_version: '2.7'
38+
- redmine_version: 5.0-stable
39+
ruby_version: '3.3'
40+
- redmine_version: 5.1-stable
41+
ruby_version: '3.3'
4642

4743
steps:
4844
- name: Setup Redmine
49-
uses: hidakatsuya/action-setup-redmine@v1
45+
uses: hidakatsuya/action-setup-redmine@v2
5046
with:
5147
repository: redmine/redmine
5248
version: ${{ matrix.redmine_version }}
@@ -82,27 +78,27 @@ jobs:
8278
- name: Run plugin tests
8379
working-directory: redmine
8480
run: |
85-
bundle exec rake redmine:plugins:test:units NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
86-
bundle exec rake redmine:plugins:test:functionals NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
87-
bundle exec rake redmine:plugins:test:integration NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
81+
bundle exec rails test plugins/redmine_custom_fields_groups/test/unit
82+
bundle exec rails test plugins/redmine_custom_fields_groups/test/functional
83+
bundle exec rails test plugins/redmine_custom_fields_groups/test/integration
8884
if [ ${{ matrix.system_test }} = "true" ]; then
89-
bundle exec rake redmine:plugins:test:system NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
85+
bundle exec rails test plugins/redmine_custom_fields_groups/test/system
9086
fi
9187
9288
# - name: Run core tests
9389
# env:
9490
# RAILS_ENV: test
9591
# PARALLEL_WORKERS: 1
9692
# working-directory: redmine
97-
# run: bundle exec rake test
93+
# run: bundle exec rails test
9894

9995
# - name: Run core system tests
10096
# if: matrix.system_test == true
10197
# env:
10298
# RAILS_ENV: test
10399
# GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
104100
# working-directory: redmine
105-
# run: bundle exec rake test:system
101+
# run: bundle exec rails test:system
106102

107103
- name: Run uninstall test
108104
working-directory: redmine

app/views/custom_fields_groups/index.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<div class="contextual">
2-
<%= link_to l(:label_custom_fields_group_new), new_custom_fields_group_path, :class => 'icon icon-add' %>
2+
<%= link_to (Redmine::VERSION.to_s >= '6.0.0') ? sprite_icon('add', l(:label_custom_fields_group_new)) : l(:label_custom_fields_group_new),
3+
new_custom_fields_group_path,
4+
:class => 'icon icon-add' %>
35
</div>
46

57
<%= title l :label_custom_fields_group_plural %>

app/views/issues/_form_custom_fields.html.erb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@
3535
<% end %>
3636
<% else %>
3737
<% fieldset_class = 'collapsible custom-fields-groups' + (all_collapsed ? ' collapsed' : '') %>
38-
<% legend_class = 'icon icon-' + (all_collapsed ? 'collapsed' : ((Redmine::VERSION.to_s >= '5.0.0') ? 'expanded' : 'expended')) %>
38+
<% legend_class = 'icon icon-' + (all_collapsed ? 'collapsed' : 'expanded') %>
3939
<% div_style = all_collapsed ? 'display: none' : '' %>
4040
<fieldset class="<%= fieldset_class %>">
41-
<%= content_tag('legend', title, :onclick => "toggleFieldset(this);", :class => legend_class) %>
41+
<%= content_tag('legend',
42+
(Redmine::VERSION.to_s >= '6.0.0') ? sprite_icon(all_collapsed ? "angle-down" : "angle-right") + title : title,
43+
:onclick => "toggleFieldset(this);",
44+
:class => legend_class) %>
4245
<% if half_width_values.present? %>
4346
<div class="splitcontent" style="<%= div_style %>">
4447
<div class="splitcontentleft">

assets/images/icons.svg

Lines changed: 13 additions & 0 deletions
Loading

assets/stylesheets/custom_fields_groups.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#admin-menu a.custom-fields-groups { background-image: url(../images/textfields_group.png);}
1+
.icon-custom-fields-groups:not(:has(svg)) { background-image: url(../images/textfields_group.png); }
22

33
h3.custom-fields-groups {
44
background: #0001;

config/icon_source.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: custom-fields-groups
2+
svg: list-check

init.rb

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
author_url 'https://github.com/georepublic'
88
url 'https://github.com/gtt-project/redmine_custom_fields_groups'
99
description 'This is a plugin for grouping custom fields'
10-
version '1.0.0'
10+
version '2.0.0'
1111

12-
requires_redmine :version_or_higher => '4.1.0'
12+
requires_redmine :version_or_higher => '5.0.0'
1313

1414
settings partial: 'settings/redmine_custom_fields_groups',
1515
default: {
@@ -22,23 +22,14 @@
2222
{ controller: 'custom_fields_groups', action: 'index' },
2323
caption: :label_custom_fields_group_plural,
2424
after: :custom_fields,
25-
html: { class: 'icon icon-custom-fields custom-fields-groups' }
25+
html: { class: 'icon icon-custom-fields-groups' },
26+
icon: 'custom-fields-groups', plugin: :redmine_custom_fields_groups
2627
end
2728

28-
if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
29-
Dir.glob("#{Rails.root}/plugins/redmine_custom_fields_groups/app/overrides/**/*.rb").each do |path|
30-
Rails.autoloaders.main.ignore(path)
31-
require path
32-
end
33-
Rails.application.config.after_initialize do
34-
RedmineCustomFieldsGroups.setup
35-
end
36-
else
37-
require 'redmine_custom_fields_groups'
38-
Rails.application.paths["app/overrides"] ||= []
39-
Rails.application.paths["app/overrides"] << File.expand_path("../app/overrides", __FILE__)
40-
41-
Rails.configuration.to_prepare do
42-
RedmineCustomFieldsGroups.setup
43-
end
29+
Dir.glob("#{Rails.root}/plugins/redmine_custom_fields_groups/app/overrides/**/*.rb").each do |path|
30+
Rails.autoloaders.main.ignore(path)
31+
require path
32+
end
33+
Rails.application.config.after_initialize do
34+
RedmineCustomFieldsGroups.setup
4435
end

lib/redmine_custom_fields_groups/patches/issues_helper_patch.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ def render_custom_fields_rows_by_groups(issue)
4545
s << render_full_width_custom_fields_rows_by_grouped_values(issue, values)
4646
else
4747
s << content_tag('fieldset', :class => 'collapsible custom-fields-groups') do
48-
concat content_tag('legend', title, :onclick => 'toggleFieldset(this);',
49-
:class => 'icon icon-' + ((Redmine::VERSION.to_s >= '5.0.0') ? 'expanded' : 'expended'))
48+
concat content_tag('legend',
49+
(Redmine::VERSION.to_s >= '6.0.0') ? sprite_icon('angle-down') + title : title,
50+
:onclick => 'toggleFieldset(this);',
51+
:class => 'icon icon-expanded')
5052
concat render_half_width_custom_fields_rows_by_grouped_values(issue, values)
5153
concat render_full_width_custom_fields_rows_by_grouped_values(issue, values)
5254
end

test/functional/custom_fields_groups_controller_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ class CustomFieldsGroupsControllerTest < ActionController::TestCase
77
setup do
88
User.current = nil
99
@request.session[:user_id] = 1 # admin
10+
if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
11+
load_plugin_fixtures(true)
12+
end
1013
end
1114

1215
teardown do

test/integration/layout_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class LayoutTest < Redmine::IntegrationTest
1111
setup do
1212
User.current = nil
1313
@user = User.find_by_login('dlopper')
14+
if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
15+
load_plugin_fixtures(true)
16+
end
1417
end
1518

1619
teardown do

0 commit comments

Comments
 (0)