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
UI update
Damian Legawiec1ce1f9f539f9
diff --git a/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.css b/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.cssindex c98f7fdff5..237ac0f4ba 100644--- a/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.css+++ b/admin/app/assets/tailwind/spree/admin/components/_bulk-editor.css@@ -1,15 +1,5 @@/* Bulk Editor - Spreadsheet-style price editing */-/* Table with collapsed borders */-[data-bulk-editor-target="table"] {- border-collapse: collapse;-}--/* Table cells with borders */-[data-bulk-editor-target="table"] td {- @apply border border-gray-200;-}-/* Input cell states */[data-bulk-editor-target="cell"] {@apply transition-colors duration-75 cursor-cell caret-transparent border-0;@@ -35,11 +25,6 @@@apply absolute pointer-events-none border-2 border-blue-500 z-10 hidden;}-/* Form container needs relative positioning for fill handle */-[data-controller="bulk-editor"] {- @apply relative;-}-/* Prevent text selection during drag operations */[data-controller="bulk-editor"].fill-dragging {@apply select-none cursor-crosshair;@@ -57,8 +42,3 @@.fill-handle:hover {@apply bg-blue-700 scale-125;}--/* Keyboard shortcut hints */-.bulk-editor-shortcuts kbd {- @apply px-1.5 py-0.5 text-xs font-mono bg-gray-100 border border-gray-200 rounded;-}diff --git a/admin/app/assets/tailwind/spree/admin/components/_forms.css b/admin/app/assets/tailwind/spree/admin/components/_forms.cssindex 88feaa6dd0..20270a6a77 100644--- a/admin/app/assets/tailwind/spree/admin/components/_forms.css+++ b/admin/app/assets/tailwind/spree/admin/components/_forms.css@@ -23,7 +23,7 @@.select-input,.form-control-sm,.custom-select-sm {- @apply block w-full py-2 px-3 text-base font-normal leading-normal;+ @apply block w-full py-2 pl-3 pr-8 text-base font-normal leading-normal;@apply text-gray-950 bg-white border border-gray-200 rounded-lg shadow-xs;@apply focus:outline-offset-2 focus:outline-blue-500 focus:border-gray-200 focus:ring-0;@apply transition-all duration-100 ease-in-out;diff --git a/admin/app/views/spree/admin/price_list_products/bulk_destroy.turbo_stream.erb b/admin/app/views/spree/admin/price_list_products/bulk_destroy.turbo_stream.erbindex 1895764b43..9280df4ce9 100644--- a/admin/app/views/spree/admin/price_list_products/bulk_destroy.turbo_stream.erb+++ b/admin/app/views/spree/admin/price_list_products/bulk_destroy.turbo_stream.erb@@ -1,3 +1,7 @@<% params[:ids]&.each do |id| %><%= turbo_stream.remove("product_#{id}") %>+<% end %>++<%= turbo_stream.update :products_count do %>+ <%= @price_list.products.distinct.count %><% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/price_list_products/bulk_new.html.erb b/admin/app/views/spree/admin/price_list_products/bulk_new.html.erbindex 9f60839ee6..aad022f719 100644--- a/admin/app/views/spree/admin/price_list_products/bulk_new.html.erb+++ b/admin/app/views/spree/admin/price_list_products/bulk_new.html.erb@@ -1,18 +1,18 @@<%= turbo_frame_tag :drawer do %>- <div data-controller="search-picker">+ <div data-controller="search-picker" class="flex flex-col justify-between h-full"><%= drawer_header(Spree.t(:add_products)) %>- <div class="drawer-body border-b">+ <div class="drawer-body border-b flex-none"><%= form_with url: spree.search_admin_products_path, method: :post, data: { controller: 'auto-submit' } do |form| %><%= form.hidden_field :omit_ids, value: @price_list.products.pluck(:id).join(',') %><%= form.search_field :q, value: params[:q], class: 'form-input w-full', placeholder: Spree.t(:search_products), data: { search_picker_target: :search, action: 'auto-submit#submit' }, autofocus: true %><% end %></div>- <%= form_with url: spree.bulk_create_admin_price_list_products_path(@parent), method: :post do |form| %>+ <%= form_with url: spree.bulk_create_admin_price_list_products_path(@parent), method: :post, class: 'grow flex flex-col justify-between' do |form| %><%= form.hidden_field :currency, value: @currency %>- <div class="drawer-body">+ <div class="drawer-body grow"><div id="products_search_results" class="search-results overflow-y-auto max-h-96"><p class="text-gray-500 text-center py-8"><%= Spree.t(:type_to_search_products) %>diff --git a/admin/app/views/spree/admin/price_list_products/index.html.erb b/admin/app/views/spree/admin/price_list_products/index.html.erbindex a036d87d35..5738713c6a 100644--- a/admin/app/views/spree/admin/price_list_products/index.html.erb+++ b/admin/app/views/spree/admin/price_list_products/index.html.erb@@ -1,9 +1,9 @@<%= turbo_frame_tag :price_list_products do %><div class="card mb-6" data-controller="media-form" data-media-form-delete-url-value="<%= spree.bulk_destroy_admin_price_list_products_path(@parent) %>">- <div class="card-header flex justify-between items-center">- <h5 class="card-title">+ <div class="card-header flex justify-between items-center border-gray-200 pr-3">+ <h5 class="card-title flex items-center gap-2"><%= Spree.t(:products) %>- <span class="badge badge-info ml-2" id="products_count"><%= @price_list.products.distinct.count %></span>+ <span class="badge badge-info" id="products_count"><%= @price_list.products.distinct.count %></span></h5><div class="flex gap-2"><button type="button"@@ -31,11 +31,11 @@<table class="table" id="listing_price_list_products"><thead><tr>- <th scope="col" class="pr-0 w-5"></th>+ <th scope="col" class="pr-0 w-5 rounded-none"></th><th scope="col"><%= Spree.t(:name) %></th><th scope="col" class="text-center"><%= Spree.t(:status) %></th><th scope="col"><%= Spree.t(:inventory) %></th>- <th scope="col"><%= Spree.t(:price) %></th>+ <th scope="col" class="rounded-none"><%= Spree.t(:price) %></th></tr></thead><tbody>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 407af09b24..d765e7e3cf 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@@ -1,71 +1,71 @@<% content_for :page_title do %>- <%= Spree.t(:edit_prices) %> - <%= @price_list.name %>+ <%= page_header_back_button(spree.admin_price_list_path(@price_list)) %>+ <%= @price_list.name %><% end %><% content_for :page_actions do %>- <%= link_to Spree.t(:back), edit_admin_price_list_path(@price_list), class: 'btn btn-secondary' %>+ <%= turbo_save_button_tag Spree.t('actions.save'), form: "edit_price_list_#{@price_list.id}" %><% end %><%= form_with model: [:admin, @price_list],method: :patch,+ html: { class: 'relative', id: "edit_price_list_#{@price_list.id}" },data: {controller: 'bulk-editor',- action: 'keydown.ctrl+a->bulk-editor#selectAll keydown.meta+a->bulk-editor#selectAll'+ action: 'keydown.ctrl+a->bulk-editor#selectAll keydown.meta+a->bulk-editor#selectAll',} do |f| %><div class="card mb-6">- <div class="card-header flex justify-between items-center">+ <div class="card-header flex justify-between items-center border-gray-200 pr-2"><div class="flex items-center gap-4"><h5 class="card-title"><%= Spree.t(:prices) %> (<%= @currency %>)</h5><span class="text-sm text-gray-500 hidden" data-bulk-editor-target="statusBar"></span></div>- <div class="flex gap-2 items-center">- <div class="text-xs text-gray-400 hidden lg:block">- <kbd class="px-1 py-0.5 bg-gray-100 rounded"><%= icon 'command', class: 'inline w-3 h-3' %>C</kbd> copy- <kbd class="px-1 py-0.5 bg-gray-100 rounded ml-2"><%= icon 'command', class: 'inline w-3 h-3' %>V</kbd> paste- <kbd class="px-1 py-0.5 bg-gray-100 rounded ml-2"><%= icon 'command', class: 'inline w-3 h-3' %>D</kbd> fill down- </div>- <%= select_tag :currency,- options_for_select(current_store.supported_currencies_list, @currency),- class: 'form-select',- onchange: "window.Turbo.visit('#{spree.edit_prices_admin_price_list_path(@price_list)}?currency=' + this.value)" %>- </div>+ <%= select_tag :currency,+ options_for_select(current_store.supported_currencies_list, @currency),+ class: 'form-select w-auto',+ onchange: "window.Turbo.visit('#{spree.edit_prices_admin_price_list_path(@price_list)}?currency=' + this.value)" %></div>- <% if @prices.any? %>- <%- # Group prices by product for display- prices_by_product = @prices.group_by { |price| price.variant.product }- row_index = 0- %>- <div class="overflow-x-auto">- <table class="w-full" data-bulk-editor-target="table">- <thead class="bg-gray-50 border-b border-gray-200">+ <div class="card-body p-0">++ <% if @prices.any? %>+ <%+ # Group prices by product for display+ prices_by_product = @prices.group_by { |price| price.variant.product }+ row_index = 0+ %>++ <table class="table" data-bulk-editor-target="table">+ <thead><tr>- <th class="px-4 py-3 text-left text-sm font-medium text-gray-600"><%= Spree.t(:title) %></th>- <th class="px-4 py-3 text-left text-sm font-medium text-gray-600"><%= Spree.t(:sku) %></th>- <th class="px-4 py-3 text-left text-sm font-medium text-gray-600 w-36"><%= Spree.t(:price) %></th>- <th class="px-4 py-3 text-left text-sm font-medium text-gray-600 w-36"><%= Spree.t(:compare_at_price) %></th>+ <th class="border-r rounded-none"><%= Spree.t(:title) %></th>+ <th class="border-r"><%= Spree.t(:sku) %></th>+ <th class="border-r w-36"><%= Spree.t(:price) %></th>+ <th class="rounded-none"><%= Spree.t(:compare_at_price) %></th></tr></thead><tbody><% prices_by_product.each do |product, prices| %><%# Product header row %>- <tr class="bg-gray-50 border-t border-b border-gray-200">- <td colspan="4" class="px-4 py-3">+ <tr class="bg-gray-50">+ <td class="border-r"><div class="flex items-center gap-3">- <%= render 'spree/admin/shared/product_image', object: product, variant: :mini %>+ <%= render 'spree/admin/shared/product_image', object: product, variant: :mini, width: 32, height: 32 %><span class="font-medium text-gray-900"><%= product.name %></span></div></td>+ <td class="border-r"></td>+ <td class="border-r"></td>+ <td></td></tr><%# Variant rows %><% prices.each do |price| %>- <%= f.fields_for :prices, price, index: row_index do |pf| %>+ <%= f.fields_for :prices, price, child_index: row_index do |pf| %><tr data-bulk-editor-target="row">- <td class="pl-14 pr-4 py-2 text-sm text-gray-600"><%= price.variant.options_text.presence %></td>- <td class="px-4 py-2 text-sm text-gray-400 font-mono"><%= price.variant.sku %></td>- <td class="p-0">+ <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"><%= pf.hidden_field :id %><%= pf.hidden_field :variant_id %><%= pf.hidden_field :currency %>@@ -81,7 +81,7 @@original_value: price.amount} %></td>- <td class="p-0">+ <td class="p-0 w-15"><%= pf.number_field :compare_at_amount,step: 0.01,placeholder: '0.00',@@ -112,8 +112,8 @@<% if @prices.any? %><div class="flex gap-3 justify-end">- <%= link_to Spree.t(:cancel), spree.admin_price_list_path(@price_list), class: 'btn btn-secondary' %>- <%= f.submit Spree.t(:save_changes),+ <%= link_to Spree.t('actions.discard'), spree.admin_price_list_path(@price_list), class: 'btn btn-light' %>+ <%= f.submit Spree.t('actions.save'),class: 'btn btn-primary',data: { bulk_editor_target: 'saveButton' } %></div>diff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 107287b0fd..b742afeb3d 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1926,7 +1926,6 @@ en:sales_totals: Sales Totalssame_as_shipping_address: Same as shipping addresssave_and_continue: Save and Continue- save_changes: Save Changessave_my_address: Save my addresssaving: Savingsay_no: 'No'diff --git a/storefront/spec/features/cart_spec.rb b/storefront/spec/features/cart_spec.rbindex ef0226eee0..da2ce9416f 100644--- a/storefront/spec/features/cart_spec.rb+++ b/storefront/spec/features/cart_spec.rb@@ -29,7 +29,8 @@ describe 'Cart', type: :feature dowithin '#line-items:first-child' doexpect(page).to have_field('line_item_quantity', with: '2')end- expect(page).to have_content(line_item.price * 2)+ # Price may be recalculated from variant when quantity changes+ expect(page).to have_content(line_item.reload.price * 2)expect(order.reload.item_total).to eq(line_item.price * 2)within '#line-items:first-child' do@@ -40,7 +41,7 @@ describe 'Cart', type: :feature dowithin '#line-items:first-child' doexpect(page).to have_field('line_item_quantity', with: '1')end- expect(page).to have_content(line_item.price)+ expect(page).to have_content(line_item.reload.price)expect(order.reload.item_total).to eq(line_item.price)end