Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change icons to svg #69

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/custom_message_settings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本題とはそれますが、
link_to_functionを通すと$(this).closest("p").remove();; return false;のようにセミコロンが自動で入るようだったのでセミコロンなしに直しています。

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
end
6 changes: 3 additions & 3 deletions app/views/custom_message_settings/_messages.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<%= select_tag 'select-key', available_message_options(@setting, lang), id: 'key-selector' %>
<span class='icon icon-help'><%= l(:text_description_of_search_box) %></span>
<span class='icon icon-help'><%= sprite_icon('help', l(:text_description_of_search_box)) %></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

icon-help は必要ないと思います。

現状では icon-help は、古いPNG画像にフォールバックするためのものにすぎません。
https://github.com/redmica/redmica/blob/7eb368c8fb93cac296321ff1b44890237271352f/app/assets/stylesheets/application.css#L1844

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全体的に既存のアイコンを表示していたクラスはそのままにしていましたが、よく考えたらRedmine6より前との互換性はどのみちないのでクラスを維持しても意味が無いですね
他のクラスも合わせて修正します

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.iconにはスタイルが適用されているため.iconのみ残します

</div>
<br>
<div class='tabular'>
Expand Down Expand Up @@ -45,8 +45,8 @@ function AddMessageInputField(key, val){
$('<a>').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();
Expand Down
2 changes: 1 addition & 1 deletion app/views/custom_message_settings/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<% end %>

<div class='message-customize-menu contextual'>
<%= 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) %>
</div>

Expand Down
4 changes: 2 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

end

Rails.application.config.i18n.load_path += Dir.glob(File.join(p.directory, 'config', 'locales', 'custom_messages', '*.rb'))