From 47e7fcf06d937751a134607e94d17de3974f3c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C4=82LTEANU?= Date: Mon, 22 Jun 2026 09:13:31 +0300 Subject: [PATCH] Refactor actions dropdown. --- app/assets/stylesheets/application.css | 1 + app/assets/stylesheets/dropdown.css | 4 ++++ app/assets/stylesheets/responsive.css | 1 + app/helpers/application_helper.rb | 13 +++++++------ test/helpers/journals_helper_test.rb | 6 +++--- test/system/copy_to_clipboard_test.rb | 4 ++-- test/system/issues_import_test.rb | 2 +- test/system/reactions_test.rb | 8 ++++---- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 2a8ea7835..54579408f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -810,6 +810,7 @@ input:disabled, select:disabled, textarea:disabled { margin-inline: 0; padding-inline-start: 10px; font-size:0.9em; + display: inline-flex; } .contextual input, .contextual select {font-size:0.9em;} diff --git a/app/assets/stylesheets/dropdown.css b/app/assets/stylesheets/dropdown.css index 648ee5b03..55550e239 100644 --- a/app/assets/stylesheets/dropdown.css +++ b/app/assets/stylesheets/dropdown.css @@ -49,6 +49,10 @@ text-decoration: none; } +.dropdown-content li a:hover .icon-svg, .dropdown-content .dropdown-items a:hover .icon-svg { + stroke: var(--oc-blue-9); +} + .dropdown-divider { border-block-start: 1px solid var(--oc-gray-2); } diff --git a/app/assets/stylesheets/responsive.css b/app/assets/stylesheets/responsive.css index ce371ae6f..72b06805b 100644 --- a/app/assets/stylesheets/responsive.css +++ b/app/assets/stylesheets/responsive.css @@ -592,6 +592,7 @@ #content>.contextual>a, #content>.contextual .drdn, + #content>.contextual .dropdown, p.buttons a { font-weight: bold; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 35b895892..0afa5077a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -899,12 +899,13 @@ module ApplicationHelper content = capture(&) if content.present? trigger = - content_tag('span', sprite_icon('3-bullets', l(:button_actions)), :class => 'icon-only icon-actions', - :title => l(:button_actions)) - trigger = content_tag('span', trigger, :class => 'drdn-trigger') - content = content_tag('div', content, :class => 'drdn-items') - content = content_tag('div', content, :class => 'drdn-content') - content_tag('span', trigger + content, :class => 'drdn') + content_tag('span', sprite_icon('3-bullets', l(:button_actions)), + :class => 'icon-only icon-actions dropdown-trigger', + :title => l(:button_actions), + :data => {:action => "click->dropdown#toggle"}) + items = content_tag('ul', content_tag('li', content), :class => 'dropdown-items') + content = content_tag('span', items, :class => 'dropdown-content hidden', :data => {:dropdown_target => "content"}) + content_tag('span', trigger + content, :class => 'dropdown', :data => {:controller => "dropdown"}) end end diff --git a/test/helpers/journals_helper_test.rb b/test/helpers/journals_helper_test.rb index 5c78761ef..83ffe502b 100644 --- a/test/helpers/journals_helper_test.rb +++ b/test/helpers/journals_helper_test.rb @@ -49,8 +49,8 @@ class JournalsHelperTest < Redmine::HelperTest assert_select_in journal_actions, 'a[title=?][class="icon-only icon-quote"]', 'Quote' assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit' - assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-del"]' - assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-copy-link"]' + assert_select_in journal_actions, '.dropdown-items a.icon-del' + assert_select_in journal_actions, '.dropdown-items a.icon-copy-link' assert_select_in journal_actions, 'span.reaction-button-wrapper' end @@ -64,7 +64,7 @@ class JournalsHelperTest < Redmine::HelperTest journal_actions = render_journal_actions(issue, journals.first, reply_links: true) assert_select_in journal_actions, 'span.reaction-button-wrapper' - assert_select_in journal_actions, 'span.drdn' + assert_select_in journal_actions, 'span.dropdown' assert_select_in journal_actions, 'a[class="icon-only icon-quote"]', false assert_select_in journal_actions, 'a[class="icon-only icon-edit"]', false diff --git a/test/system/copy_to_clipboard_test.rb b/test/system/copy_to_clipboard_test.rb index 3ff947b0b..b56490b2b 100644 --- a/test/system/copy_to_clipboard_test.rb +++ b/test/system/copy_to_clipboard_test.rb @@ -26,7 +26,7 @@ class CopyToClipboardSystemTest < ApplicationSystemTestCase # Copy issue url to Clipboard first('.contextual span.icon-actions').click - find('.contextual div.drdn-items a.icon-copy-link').click + find('.contextual .dropdown-items a.icon-copy-link').click # Paste the value copied to the clipboard into the textarea to get and test first('.icon-edit').click @@ -40,7 +40,7 @@ class CopyToClipboardSystemTest < ApplicationSystemTestCase # Copy issue journal url to Clipboard first('#note-2 .icon-actions').click - first('#note-2 div.drdn-items a.icon-copy-link').click + first('#note-2 .dropdown-items a.icon-copy-link').click # Paste the value copied to the clipboard into the textarea to get and test first('.icon-edit').click diff --git a/test/system/issues_import_test.rb b/test/system/issues_import_test.rb index d0b1c064e..e321c7cd3 100644 --- a/test/system/issues_import_test.rb +++ b/test/system/issues_import_test.rb @@ -23,7 +23,7 @@ class IssuesImportTest < ApplicationSystemTestCase def test_import_issues_without_failures log_user('jsmith', 'jsmith') visit '/issues' - find('div.contextual>span.drdn').click + find('div.contextual>span.dropdown').click click_on 'Import' attach_file 'file', Rails.root.join('test/fixtures/files/import_issues.csv') diff --git a/test/system/reactions_test.rb b/test/system/reactions_test.rb index 96dd4cf81..241d799b1 100644 --- a/test/system/reactions_test.rb +++ b/test/system/reactions_test.rb @@ -130,12 +130,12 @@ class ReactionsSystemTest < ApplicationSystemTestCase assert_selector 'a.reaction-button' assert_no_selector 'a.icon-quote' - assert_no_selector 'span.drdn' + assert_no_selector 'span.dropdown' end within("#change-#{journal_without_notes.id}") do assert_selector 'a.reaction-button' - assert_no_selector '.drdn' + assert_no_selector '.dropdown' end click_link 'History' @@ -144,11 +144,11 @@ class ReactionsSystemTest < ApplicationSystemTestCase assert_selector 'a.reaction-button' assert_selector 'a.icon-quote' - assert_selector 'span.drdn' + assert_selector 'span.dropdown' end within("#change-#{journal_without_notes.id}") do assert_selector 'a.reaction-button' - assert_selector 'span.drdn' + assert_selector 'span.dropdown' assert_no_selector 'a.icon-quote' end -- 2.50.1 (Apple Git-155)