From 2f60a207b22fba4e59e3b7a9b4780e3c0ded2dd6 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Mon, 18 Nov 2024 05:29:46 +0000 Subject: [PATCH 1/4] Change icons to svg --- app/helpers/custom_message_settings_helper.rb | 6 +++--- app/views/custom_message_settings/_messages.html.erb | 6 +++--- app/views/custom_message_settings/edit.html.erb | 2 +- init.rb | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/helpers/custom_message_settings_helper.rb b/app/helpers/custom_message_settings_helper.rb index 3fab8dd..5206f84 100644 --- a/app/helpers/custom_message_settings_helper.rb +++ b/app/helpers/custom_message_settings_helper.rb @@ -17,17 +17,17 @@ def normal_mode_input_fields(setting, lang) content += content_tag(:p) do content_tag(:label, k) + text_field_tag("settings[custom_messages][#{k}]", v.to_s) + - link_to_function('', '$(this).closest("p").remove();', class: 'icon icon-del clear-key-link') + link_to_function(sprite_icon('del'), '$(this).closest("p").remove()', class: 'icon icon-del clear-key-link') end end content end def open_default_messages_window_link(lang) - link_to l(:label_default_messages), + link_to sprite_icon('file', l(:label_default_messages)), default_messages_custom_message_settings_path(lang: lang), class: 'icon icon-file text-plain', onclick: "window.open(this.href,'redmine_message_customize_plugin-default_messages', 'height=800, width=500');return false;", id: 'default-messages-link' end -end \ No newline at end of file +end diff --git a/app/views/custom_message_settings/_messages.html.erb b/app/views/custom_message_settings/_messages.html.erb index d8486d4..df3b8bf 100644 --- a/app/views/custom_message_settings/_messages.html.erb +++ b/app/views/custom_message_settings/_messages.html.erb @@ -1,6 +1,6 @@
<%= select_tag 'select-key', available_message_options(@setting, lang), id: 'key-selector' %> - <%= l(:text_description_of_search_box) %> + <%= sprite_icon('help', l(:text_description_of_search_box)) %>

@@ -45,8 +45,8 @@ function AddMessageInputField(key, val){ $('').attr({ class: 'icon icon-del clear-key-link', href: '#', - onclick: '$(this).closest("p").remove();; return false;' - }).appendTo($('#edit-custom-messages .tabular p:first')); + onclick: '$(this).closest("p").remove(); return false;' + }).html('<%= sprite_icon('del') %>').appendTo($('#edit-custom-messages .tabular p:first')); $('#key-selector').val('').change(); $('#key-selector option[value="' + key + '"]').prop("disabled", true).change(); setSelect2(); diff --git a/app/views/custom_message_settings/edit.html.erb b/app/views/custom_message_settings/edit.html.erb index 8dbbf15..2b9cb88 100644 --- a/app/views/custom_message_settings/edit.html.erb +++ b/app/views/custom_message_settings/edit.html.erb @@ -8,7 +8,7 @@ <% end %>
- <%= link_to (@setting.enabled? ? l(:label_disable_customize) : l(:label_enable_customize)), toggle_enabled_custom_message_settings_path, method: :post, class: 'icon icon-settings' %> / + <%= link_to sprite_icon('settings', (@setting.enabled? ? l(:label_disable_customize) : l(:label_enable_customize))), toggle_enabled_custom_message_settings_path, method: :post, class: 'icon icon-settings' %> / <%= open_default_messages_window_link(@lang) %>
diff --git a/init.rb b/init.rb index 9de5077..c155884 100644 --- a/init.rb +++ b/init.rb @@ -13,8 +13,8 @@ author_url 'https://github.com/farend' settings default: { custom_messages: {} } menu :admin_menu, :custom_messages, { controller: 'custom_message_settings', action: 'edit' }, - caption: :label_custom_messages, html: { class: 'icon icon-edit' } - requires_redmine version_or_higher: '3.2' + caption: :label_custom_messages, html: { class: 'icon icon-edit' }, icon: 'edit' + requires_redmine version_or_higher: '6.0' end Rails.application.config.i18n.load_path += Dir.glob(File.join(p.directory, 'config', 'locales', 'custom_messages', '*.rb')) From 30323d1b42b65c7471670c9d40412c5583db7125 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Mon, 18 Nov 2024 06:52:00 +0000 Subject: [PATCH 2/4] Remove RedMica3.0 from the test target --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7600fd..67477a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,9 +11,6 @@ jobs: strategy: matrix: include: - - redmine-repository: 'redmica/redmica' - redmine-version: 'stable-3.0' - ruby-version: '3.3' - redmine-repository: 'redmica/redmica' redmine-version: 'master' ruby-version: '3.3' From 7f7fe0960c3dc561f0d51ab7a5adeaf06e86fc61 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Mon, 18 Nov 2024 07:07:27 +0000 Subject: [PATCH 3/4] Remove unnecessary classes --- app/helpers/custom_message_settings_helper.rb | 4 ++-- app/views/custom_message_settings/_messages.html.erb | 4 ++-- app/views/custom_message_settings/edit.html.erb | 2 +- init.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/custom_message_settings_helper.rb b/app/helpers/custom_message_settings_helper.rb index 5206f84..4be0e87 100644 --- a/app/helpers/custom_message_settings_helper.rb +++ b/app/helpers/custom_message_settings_helper.rb @@ -17,7 +17,7 @@ def normal_mode_input_fields(setting, lang) content += content_tag(:p) do content_tag(:label, k) + text_field_tag("settings[custom_messages][#{k}]", v.to_s) + - link_to_function(sprite_icon('del'), '$(this).closest("p").remove()', class: 'icon icon-del clear-key-link') + link_to_function(sprite_icon('del'), '$(this).closest("p").remove()', class: 'icon clear-key-link') end end content @@ -26,7 +26,7 @@ def normal_mode_input_fields(setting, lang) def open_default_messages_window_link(lang) link_to sprite_icon('file', l(:label_default_messages)), default_messages_custom_message_settings_path(lang: lang), - class: 'icon icon-file text-plain', + class: 'icon text-plain', onclick: "window.open(this.href,'redmine_message_customize_plugin-default_messages', 'height=800, width=500');return false;", id: 'default-messages-link' end diff --git a/app/views/custom_message_settings/_messages.html.erb b/app/views/custom_message_settings/_messages.html.erb index df3b8bf..aafe6b5 100644 --- a/app/views/custom_message_settings/_messages.html.erb +++ b/app/views/custom_message_settings/_messages.html.erb @@ -1,6 +1,6 @@
<%= select_tag 'select-key', available_message_options(@setting, lang), id: 'key-selector' %> - <%= sprite_icon('help', l(:text_description_of_search_box)) %> + <%= sprite_icon('help', l(:text_description_of_search_box)) %>

@@ -43,7 +43,7 @@ function AddMessageInputField(key, val){ name: 'settings[custom_messages][' + key + ']' }).appendTo($('#edit-custom-messages .tabular p:first')); $('').attr({ - class: 'icon icon-del clear-key-link', + class: 'icon clear-key-link', href: '#', onclick: '$(this).closest("p").remove(); return false;' }).html('<%= sprite_icon('del') %>').appendTo($('#edit-custom-messages .tabular p:first')); diff --git a/app/views/custom_message_settings/edit.html.erb b/app/views/custom_message_settings/edit.html.erb index 2b9cb88..b13f818 100644 --- a/app/views/custom_message_settings/edit.html.erb +++ b/app/views/custom_message_settings/edit.html.erb @@ -8,7 +8,7 @@ <% end %>
- <%= link_to sprite_icon('settings', (@setting.enabled? ? l(:label_disable_customize) : l(:label_enable_customize))), toggle_enabled_custom_message_settings_path, method: :post, class: 'icon icon-settings' %> / + <%= link_to sprite_icon('settings', (@setting.enabled? ? l(:label_disable_customize) : l(:label_enable_customize))), toggle_enabled_custom_message_settings_path, method: :post, class: 'icon' %> / <%= open_default_messages_window_link(@lang) %>
diff --git a/init.rb b/init.rb index c155884..c497f0e 100644 --- a/init.rb +++ b/init.rb @@ -13,7 +13,7 @@ author_url 'https://github.com/farend' settings default: { custom_messages: {} } menu :admin_menu, :custom_messages, { controller: 'custom_message_settings', action: 'edit' }, - caption: :label_custom_messages, html: { class: 'icon icon-edit' }, icon: 'edit' + caption: :label_custom_messages, html: { class: 'icon' }, icon: 'edit' requires_redmine version_or_higher: '6.0' end From d1df8f988219fafa524af8b656c26613f38ffae5 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Mon, 18 Nov 2024 07:08:49 +0000 Subject: [PATCH 4/4] Update README --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dac21ae..a8857d1 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,17 @@ # redmine_message_customize This is a plugin for Redmine. -This plugin changes the translation of the wording on the screen defined in "config/locales/*.yml" in the admin view. +This plugin changes the translation of the wording on the screen defined in "config/locales/*.yml" in the admin view. +It is available for Redmine 6.0 or later. ## Install ``` $ cd /your/path/redmine $ git clone https://github.com/farend/redmine_message_customize.git plugins/redmine_message_customize -$ # When Redmine 4.1 or lower versions -$ cp plugins/redmine_message_customize/35_change_load_order_locales.rb config/initializers/35_change_load_order_locales.rb $ # redmine restart ``` -:warning: To customize messages for other plugins in **Redmine 4.1 or lower versions**, redmine_message_customize/35_change_load_order_locales.rb It is necessary to copy the file to redmine/config/initializers. -If redmine/config/initializers/35_change_load_order_locales.rb is missing, only non-plugin messages can be customized. - ## Usage * 1: Open setting page