Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Admin: Improve modals, fix JS error in promotion modals
Damian Legawiecdd1d63a78c7f
diff --git a/admin/app/javascript/spree/admin/helpers/bootstrap.js b/admin/app/javascript/spree/admin/helpers/bootstrap.jsindex f15a71a17e..6fd0c9aea4 100644--- a/admin/app/javascript/spree/admin/helpers/bootstrap.js+++ b/admin/app/javascript/spree/admin/helpers/bootstrap.js@@ -21,8 +21,21 @@ const removeTooltips = () => {})}+const resetDialogModal = () => {+ const modalElement = document.getElementById('dialog_modal')+ const modalTitle = modalElement ? modalElement.querySelector('.modal-title') : null+ const modalBody = modalElement ? modalElement.querySelector('.modal-body') : null+ if (modalBody) {+ modalBody.innerHTML = '<div class="spinner-border text-light mx-auto my-5" role="status"><span class="sr-only">Loading...</span></div>'+ }+ if (modalTitle) {+ modalTitle.innerHTML = 'Loading...'+ }+}+$('.modal').on('show.bs.modal', lockScroll)$('.modal').on('hide.bs.modal', unlockScroll)+$('.modal').on('hidden.bs.modal ', resetDialogModal)document.addEventListener("turbo:click", removeTooltips)document.addEventListener("turbo:load", initTooltips)diff --git a/admin/app/views/spree/admin/promotion_actions/new.html.erb b/admin/app/views/spree/admin/promotion_actions/new.html.erbindex d35debbb5b..db48b5cfd6 100644--- a/admin/app/views/spree/admin/promotion_actions/new.html.erb+++ b/admin/app/views/spree/admin/promotion_actions/new.html.erb@@ -1,6 +1,6 @@<%= turbo_frame_tag :dialog_modal do %><%= form_with model: @promotion_action, url: spree.admin_promotion_actions_path(@promotion), method: :post, scope: :promotion_action do |f| %>- <div class="modal-content" data-controller="search-picker">+ <div class="modal-content"><div class="modal-header"><h5 class="modal-title"><% if @promotion_action.type.nil? %>diff --git a/admin/app/views/spree/admin/promotion_rules/new.html.erb b/admin/app/views/spree/admin/promotion_rules/new.html.erbindex d2c66d0cb2..d84b4c8d00 100644--- a/admin/app/views/spree/admin/promotion_rules/new.html.erb+++ b/admin/app/views/spree/admin/promotion_rules/new.html.erb@@ -1,6 +1,6 @@<%= turbo_frame_tag :dialog_modal do %><%= form_with model: @promotion_rule, url: spree.admin_promotion_rules_path(@promotion), method: :post, scope: :promotion_rule do |f| %>- <div class="modal-content" data-controller="search-picker">+ <div class="modal-content"><div class="modal-header"><h5 class="modal-title"><% if @promotion_rule.type.nil? %>diff --git a/admin/app/views/spree/admin/shared/_modal.html.erb b/admin/app/views/spree/admin/shared/_modal.html.erbindex de1ee73292..475d01fe58 100644--- a/admin/app/views/spree/admin/shared/_modal.html.erb+++ b/admin/app/views/spree/admin/shared/_modal.html.erb@@ -6,7 +6,7 @@<h5 class="modal-title" id="exampleModalLabel"><%= Spree.t(:loading) %>...</h5><button type="button" class="btn-close" data-dismiss="modal" aria-label="<%= Spree.t(:close) %>" /></div>- <div class="modal-body text-center" style="min-height: 200px">+ <div class="modal-body text-center"><div class="spinner-border text-light mx-auto my-5" role="status"><span class="sr-only"><%= Spree.t(:loading) %>...</span></div>