Skip to content

Commit dd6bcaf

Browse files
committed
Support Redmine 6.0 and drop Redmine 4.2
1 parent 7a1a0c1 commit dd6bcaf

File tree

7 files changed

+38
-25
lines changed

7 files changed

+38
-25
lines changed

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

0 commit comments

Comments
 (0)