Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Remove unused JS code from Admin Promotions

Damian Legawiece8c89decb03e
diff --git a/backend/app/assets/javascripts/spree/backend/promotions.js b/backend/app/assets/javascripts/spree/backend/promotions.js
index 444b3ab754..21fa4641d8 100644
--- a/backend/app/assets/javascripts/spree/backend/promotions.js
+++ b/backend/app/assets/javascripts/spree/backend/promotions.js
@@ -1,15 +1,6 @@
function initProductActions () {
'use strict'
- // Add classes on promotion items for design
- $(document).on('mouseover mouseout', 'a.delete', function (event) {
- if (event.type === 'mouseover') {
- $(this).parent().addClass('action-remove')
- } else {
- $(this).parent().removeClass('action-remove')
- }
- })
-
$('#promotion-filters').find('.variant_autocomplete').variantAutocomplete()
$('.calculator-fields').each(function () {
@@ -171,5 +162,9 @@ function initProductActions () {
}
$(document).ready(function () {
- initProductActions()
+ var promotion_form = $('form.edit_promotion')
+
+ if (promotion_form.length) {
+ initProductActions()
+ }
})