From 51631c2b5a94ba0535dda9c3f1753cb20cefa229 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Tue, 14 Nov 2023 14:44:34 +0100 Subject: [PATCH] Implement toggle and ESC event for address menu --- .../solidus_admin/orders/show/address/component.html.erb | 1 + .../solidus_admin/orders/show/address/component.js | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 admin/app/components/solidus_admin/orders/show/address/component.js diff --git a/admin/app/components/solidus_admin/orders/show/address/component.html.erb b/admin/app/components/solidus_admin/orders/show/address/component.html.erb index dc8e5c10ae1..69df7948f9c 100644 --- a/admin/app/components/solidus_admin/orders/show/address/component.html.erb +++ b/admin/app/components/solidus_admin/orders/show/address/component.html.erb @@ -24,6 +24,7 @@ <%= tag.a( href: solidus_admin.send("order_#{@type}_address_path", @order, address_id: address.id), class: 'block text-black text-sm hover:bg-gray-50 p-2 mx-2 w-auto rounded-lg', + 'data-action': "#{stimulus_id}#close", ) do %> <%= format_address(address) %> <% end %> diff --git a/admin/app/components/solidus_admin/orders/show/address/component.js b/admin/app/components/solidus_admin/orders/show/address/component.js new file mode 100644 index 00000000000..8311a179065 --- /dev/null +++ b/admin/app/components/solidus_admin/orders/show/address/component.js @@ -0,0 +1,9 @@ +import { Controller } from '@hotwired/stimulus' + +export default class extends Controller { + static targets = ["userAddresses"] + + close() { + this.userAddressesTarget.removeAttribute('open') + } +}