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
Improve Checkout special instructions UX (adding autogrow stimulus controller)
Damian Legawiec12cc3f926bb4
diff --git a/admin/config/importmap.rb b/admin/config/importmap.rbindex 58e06822b3..86ef78ea0b 100644--- a/admin/config/importmap.rb+++ b/admin/config/importmap.rb@@ -23,7 +23,6 @@ pin '@stimulus-components/rails-nested-form', to: '@stimulus-components--rails-npin 'stimulus-notification', preload: ['application-spree-admin'] # @2.2.0pin 'stimulus-password-visibility', preload: ['application-spree-admin'] # @2.1.1pin 'stimulus-sortable', preload: ['application-spree-admin'] # @4.1.1-pin 'stimulus-textarea-autogrow', preload: ['application-spree-admin'] # @4.1.0pin 'hotkeys-js', preload: ['application-spree-admin'] # @3.13.9pin 'stimulus-use', preload: ['application-spree-admin'] # @0.51.3pin 'stimulus-checkbox-select-all', preload: ['application-spree-admin'] # @5.3.0diff --git a/core/config/importmap.rb b/core/config/importmap.rbindex 6fe5693891..5f89ed900c 100644--- a/core/config/importmap.rb+++ b/core/config/importmap.rb@@ -3,6 +3,7 @@ pin '@rails/request.js', to: '@rails--request.js.js', preload: ['application-sprpin 'tailwindcss-stimulus-components', preload: ['application-spree-storefront', 'application-spree-admin'] # @3.0.4pin 'stimulus-reveal-controller', preload: ['application-spree-admin'] # @4.1.0pin '@stimulus-components/auto-submit', to: '@stimulus-components--auto-submit.js', preload: ['application-spree-admin'] # @6.0.0+pin 'stimulus-textarea-autogrow', preload: ['application-spree-admin'] # @4.1.0pin_all_from Spree::Core::Engine.root.join('app/javascript/spree/core/controllers'),under: 'spree/core/controllers',diff --git a/admin/vendor/javascript/stimulus-textarea-autogrow.js b/core/vendor/javascript/stimulus-textarea-autogrow.jssimilarity index 100%rename from admin/vendor/javascript/stimulus-textarea-autogrow.jsrename to core/vendor/javascript/stimulus-textarea-autogrow.jsdiff --git a/storefront/app/javascript/spree/storefront/application.js b/storefront/app/javascript/spree/storefront/application.jsindex 04a0b3c5b0..41633a22e6 100644--- a/storefront/app/javascript/spree/storefront/application.js+++ b/storefront/app/javascript/spree/storefront/application.js@@ -58,6 +58,7 @@ const controllers = ['slideover-account','slideover','sticky-button',+ 'textarea-autogrow','toggle-menu','turbo-stream-form','wished-item',@@ -74,6 +75,7 @@ const manifest = {"reveal": "stimulus-reveal-controller","scroll-to": "stimulus-scroll-to","read-more": "stimulus-read-more",+ "textarea-autogrow": "stimulus-textarea-autogrow"}import { lazyLoadControllersFromManifest } from "spree/storefront/helpers/lazy_load_controllers_with_manifest"diff --git a/storefront/app/views/spree/checkout/_special_instructions.html.erb b/storefront/app/views/spree/checkout/_special_instructions.html.erbindex 351be8502d..1b7d60f186 100644--- a/storefront/app/views/spree/checkout/_special_instructions.html.erb+++ b/storefront/app/views/spree/checkout/_special_instructions.html.erb@@ -4,7 +4,7 @@<%= I18n.t('activerecord.attributes.spree/order.special_instructions') %></h5><div class="form-group">- <%= form.text_area :special_instructions, class: 'w-full text-input', rows: 2, placeholder: Spree.t('storefront.checkout.special_instructions_placeholder') %>+ <%= form.text_area :special_instructions, class: 'w-full text-input', rows: 2, placeholder: Spree.t('storefront.checkout.special_instructions_placeholder'), data: { controller: 'textarea-autogrow' } %></div></div><% end %>