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
Add currency symbol in bulk editor cells when editing prices in price list
Damian Legawiecb58fff834543
diff --git a/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.css b/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.cssindex 237ac0f4ba..5b7b07446c 100644--- a/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.css+++ b/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.css@@ -2,22 +2,31 @@/* Input cell states */[data-bulk-editor-target="cell"] {- @apply transition-colors duration-75 cursor-cell caret-transparent border-0;+ @apply transition-colors duration-75 cursor-cell caret-transparent;+ /* Override any form styling */+ border: none !important;+ box-shadow: none !important;+ border-radius: 0 !important;+ background: transparent !important;}-/* Selected cells - light background, no individual border */-[data-bulk-editor-target="cell"].selected {+/* Selected cells - light background on parent cell container */+.bulk-editor-cell:has([data-bulk-editor-target="cell"].selected) {@apply bg-blue-50;}-/* Focused cell in selection mode */-[data-bulk-editor-target="cell"]:focus {+/* Focused cell in selection mode - background on parent */+.bulk-editor-cell:has([data-bulk-editor-target="cell"]:focus) {@apply bg-blue-100;}/* Editing mode - white background, text cursor, visible caret */+.bulk-editor-cell:has([data-bulk-editor-target="cell"].editing) {+ @apply bg-white;+}+[data-bulk-editor-target="cell"].editing {- @apply bg-white cursor-text caret-inherit;+ @apply cursor-text caret-inherit;}/* Selection overlay - single border around entire selection */diff --git a/admin/app/controllers/spree/admin/price_lists_controller.rb b/admin/app/controllers/spree/admin/price_lists_controller.rbindex 307eaa8fc1..c42519298f 100644--- a/admin/app/controllers/spree/admin/price_lists_controller.rb+++ b/admin/app/controllers/spree/admin/price_lists_controller.rb@@ -6,6 +6,7 @@ module Spree# GET /admin/price_lists/:price_list_id/edit_pricesdef edit_prices@currency = params[:currency] || current_store.default_currency+ @currency_symbol = ::Money::Currency.find(@currency).symbol@prices = @price_list.prices.includes(variant: [:product, { option_values: :option_type }]).where(currency: @currency).diff --git a/admin/app/javascript/spree/admin/controllers/bulk_editor_controller.js b/admin/app/javascript/spree/admin/controllers/bulk_editor_controller.jsindex 0c168715ec..98fa6ea31c 100644--- a/admin/app/javascript/spree/admin/controllers/bulk_editor_controller.js+++ b/admin/app/javascript/spree/admin/controllers/bulk_editor_controller.js@@ -105,7 +105,9 @@ export default class extends Controller {}const cell = this.focusedCell- const cellRect = cell.getBoundingClientRect()+ // Use parent .bulk-editor-cell or <td> if available for proper positioning+ const cellContainer = cell.closest('.bulk-editor-cell') || cell.closest('td') || cell+ const cellRect = cellContainer.getBoundingClientRect()const containerRect = this.element.getBoundingClientRect()// Position at bottom-right corner of the focused cell@@ -350,7 +352,9 @@ export default class extends Controller {let maxRight = -Infinity, maxBottom = -Infinitycells.forEach(cell => {- const rect = cell.getBoundingClientRect()+ // Use parent .bulk-editor-cell or <td> if available for proper bounds+ const cellContainer = cell.closest('.bulk-editor-cell') || cell.closest('td') || cell+ const rect = cellContainer.getBoundingClientRect()minLeft = Math.min(minLeft, rect.left)minTop = Math.min(minTop, rect.top)maxRight = Math.max(maxRight, rect.right)diff --git a/admin/app/views/spree/admin/price_lists/_products_header.html.erb b/admin/app/views/spree/admin/price_lists/_products_header.html.erbindex 29333f8954..54fb14a6ab 100644--- a/admin/app/views/spree/admin/price_lists/_products_header.html.erb+++ b/admin/app/views/spree/admin/price_lists/_products_header.html.erb@@ -4,12 +4,12 @@<span class="badge badge-info"><%= @price_list.products.distinct.count %></span></h5><div class="flex gap-2">- <%= link_to Spree.t(:add_products),+ <%= link_to_with_icon 'plus', Spree.t(:add_products),spree.bulk_new_admin_price_list_products_path(@price_list),class: 'btn btn-sm btn-light',data: { action: 'drawer#open', turbo_frame: :drawer } %><% if @price_list.prices.any? %>- <%= link_to Spree.t(:edit_prices),+ <%= link_to_with_icon 'pencil-dollar', Spree.t(:edit_prices),spree.edit_prices_admin_price_list_path(@price_list),class: 'btn btn-sm btn-primary',data: { turbo_frame: '_top' } %>diff --git a/admin/app/views/spree/admin/price_lists/edit_prices.html.erb b/admin/app/views/spree/admin/price_lists/edit_prices.html.erbindex d765e7e3cf..44cbe49d12 100644--- a/admin/app/views/spree/admin/price_lists/edit_prices.html.erb+++ b/admin/app/views/spree/admin/price_lists/edit_prices.html.erb@@ -65,34 +65,40 @@<tr data-bulk-editor-target="row"><td class="pl-14 pr-4 py-2 text-sm text-gray-600 border-r w-40"><%= price.variant.options_text.presence %></td><td class="px-4 py-2 text-sm text-gray-400 font-mono border-r w-30"><%= price.variant.sku %></td>- <td class="p-0 border-r w-15">+ <td class="p-0 border-r w-15 bulk-editor-cell"><%= pf.hidden_field :id %><%= pf.hidden_field :variant_id %><%= pf.hidden_field :currency %>- <%= pf.number_field :amount,- step: 0.01,- placeholder: '0.00',- class: 'w-full px-4 py-2 focus:outline-none text-right tabular-nums',- data: {- bulk_editor_target: 'cell',- row: row_index,- col: 0,- action: bulk_editor_cell_actions,- original_value: price.amount- } %>+ <label class="flex items-center cursor-cell m-0">+ <span class="pl-4 text-gray-500 pointer-events-none"><%= @currency_symbol %></span>+ <%= pf.number_field :amount,+ step: 0.01,+ placeholder: '0.00',+ class: 'w-full pl-1 pr-4 py-2 border-0 shadow-none outline-none text-right tabular-nums bg-transparent',+ data: {+ bulk_editor_target: 'cell',+ row: row_index,+ col: 0,+ action: bulk_editor_cell_actions,+ original_value: price.amount+ } %>+ </label></td>- <td class="p-0 w-15">- <%= pf.number_field :compare_at_amount,- step: 0.01,- placeholder: '0.00',- class: 'w-full px-4 py-2 focus:outline-none text-right tabular-nums',- data: {- bulk_editor_target: 'cell',- row: row_index,- col: 1,- action: bulk_editor_cell_actions,- original_value: price.compare_at_amount- } %>+ <td class="p-0 w-15 bulk-editor-cell">+ <label class="flex items-center cursor-cell m-0">+ <span class="pl-4 text-gray-500 pointer-events-none"><%= @currency_symbol %></span>+ <%= pf.number_field :compare_at_amount,+ step: 0.01,+ placeholder: '0.00',+ class: 'w-full pl-1 pr-4 py-2 border-0 shadow-none outline-none text-right tabular-nums bg-transparent',+ data: {+ bulk_editor_target: 'cell',+ row: row_index,+ col: 1,+ action: bulk_editor_cell_actions,+ original_value: price.compare_at_amount+ } %>+ </label></td></tr><% row_index += 1 %>