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
Migrate 11 admin resources from index_table to Tables API (#13714)
Damian Legawiec7ab87989e08e
diff --git a/spree/admin/app/helpers/spree/admin/table_helper.rb b/spree/admin/app/helpers/spree/admin/table_helper.rbindex 3beae22eb4..9a22673bbd 100644--- a/spree/admin/app/helpers/spree/admin/table_helper.rb+++ b/spree/admin/app/helpers/spree/admin/table_helper.rb@@ -125,7 +125,7 @@ module Spreedef render_status_column(value, column)return empty_column_placeholder if value.blank?- css_class = STATUS_BADGE_CLASSES[value.to_s] || 'badge-secondary'+ css_class = STATUS_BADGE_CLASSES[value.to_s] || 'badge-light'content_tag(:span, Spree.t(value, scope: column.key, default: value.to_s.humanize), class: "badge #{css_class}")end@@ -222,7 +222,10 @@ module Spree# @param column [Spree::Admin::Table::Column] column definition# @return [String]def column_cell_class(column)- column.align.to_s == 'left' ? '' : "text-#{column.align}"+ [].tap do |classes|+ classes << "text-#{column.align}" unless column.align.to_s == 'left'+ classes << (column.wrap ? 'text-wrap' : 'text-nowrap')+ end.join(' ')end# Build query builder fields JSON for Stimulus controllerdiff --git a/spree/admin/app/models/spree/admin/table/column.rb b/spree/admin/app/models/spree/admin/table/column.rbindex 8b3b90a5ea..4747aae500 100644--- a/spree/admin/app/models/spree/admin/table/column.rb+++ b/spree/admin/app/models/spree/admin/table/column.rb@@ -37,6 +37,7 @@ module Spreeattribute :methodattribute :width, :stringattribute :align, :string, default: 'left'+ attribute :wrap, :boolean, default: falseattribute :format, :stringattribute :conditionattribute :ransack_attribute, :stringdiff --git a/spree/admin/app/views/spree/admin/refund_reasons/_table_header.html.erb b/spree/admin/app/views/spree/admin/refund_reasons/_table_header.html.erbdeleted file mode 100644index 15ab396f65..0000000000--- a/spree/admin/app/views/spree/admin/refund_reasons/_table_header.html.erb+++ /dev/null@@ -1,6 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= Spree.t(:status) %></th>- <th scope="col"><%= Spree.t(:mutable) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/refund_reasons/_table_row.html.erb b/spree/admin/app/views/spree/admin/refund_reasons/_table_row.html.erbdeleted file mode 100644index 247eb63014..0000000000--- a/spree/admin/app/views/spree/admin/refund_reasons/_table_row.html.erb+++ /dev/null@@ -1,14 +0,0 @@-<tr id="<%= spree_dom_id refund_reason %>" data-controller="row-link" class="cursor-pointer">- <td class="w-40 align-center" data-action="click->row-link#openLink">- <%= refund_reason.name %>- </td>- <td class="w-20 align-center" data-action="click->row-link#openLink">- <%= active_badge(refund_reason.active, label: Spree.t(refund_reason.active? ? :active : :inactive)) %>- </td>- <td class="w-10 align-center" data-action="click->row-link#openLink">- <%= active_badge(refund_reason.mutable) %>- </td>- <td class="actions w-10" data-action="click->row-link#openLink">- <%= link_to_edit(refund_reason, no_text: true, data: { row_link_target: :link, turbo_frame: '_top' }) if can? :edit, refund_reason %>- </td>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/refund_reasons/index.html.erb b/spree/admin/app/views/spree/admin/refund_reasons/index.html.erbindex e926bfa3ac..03229a2bc1 100644--- a/spree/admin/app/views/spree/admin/refund_reasons/index.html.erb+++ b/spree/admin/app/views/spree/admin/refund_reasons/index.html.erb@@ -7,4 +7,4 @@<%= render_admin_partials(:refund_reasons_header_partials) %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :refund_reasons %>diff --git a/spree/admin/app/views/spree/admin/reimbursement_types/_table_header.html.erb b/spree/admin/app/views/spree/admin/reimbursement_types/_table_header.html.erbdeleted file mode 100644index db72f87f7f..0000000000--- a/spree/admin/app/views/spree/admin/reimbursement_types/_table_header.html.erb+++ /dev/null@@ -1,7 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= Spree.t(:type) %></th>- <th scope="col"><%= Spree.t(:status) %></th>- <th scope="col"><%= Spree.t(:mutable) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/reimbursement_types/_table_row.html.erb b/spree/admin/app/views/spree/admin/reimbursement_types/_table_row.html.erbdeleted file mode 100644index 6ad64d1fa8..0000000000--- a/spree/admin/app/views/spree/admin/reimbursement_types/_table_row.html.erb+++ /dev/null@@ -1,17 +0,0 @@-<tr id="<%= spree_dom_id reimbursement_type %>" data-controller="row-link">- <td class="w-40 align-center cursor-pointer" data-action="click->row-link#openLink">- <%= reimbursement_type.name.humanize %>- </td>- <td class="w-30 cursor-pointer" data-action="click->row-link#openLink">- <code><%= reimbursement_type.type.demodulize %></code>- </td>- <td class="w-10 align-center cursor-pointer" data-action="click->row-link#openLink">- <%= active_badge(reimbursement_type.active, label: Spree.t(reimbursement_type.active? ? :active : :inactive)) %>- </td>- <td class="w-10 align-center cursor-pointer" data-action="click->row-link#openLink">- <%= active_badge(reimbursement_type.mutable) %>- </td>- <td class="actions w-10">- <%= link_to_edit reimbursement_type, no_text: true, data: { row_link_target: :link, turbo_frame: '_top' } if can?(:edit, reimbursement_type) %>- </td>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/reimbursement_types/index.html.erb b/spree/admin/app/views/spree/admin/reimbursement_types/index.html.erbindex 59d81fa414..2d7d2520f4 100644--- a/spree/admin/app/views/spree/admin/reimbursement_types/index.html.erb+++ b/spree/admin/app/views/spree/admin/reimbursement_types/index.html.erb@@ -7,4 +7,4 @@<%= render_admin_partials(:reimbursement_types_header_partials) %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :reimbursement_types %>diff --git a/spree/admin/app/views/spree/admin/return_authorization_reasons/_table_header.html.erb b/spree/admin/app/views/spree/admin/return_authorization_reasons/_table_header.html.erbdeleted file mode 100644index 474969a099..0000000000--- a/spree/admin/app/views/spree/admin/return_authorization_reasons/_table_header.html.erb+++ /dev/null@@ -1,5 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= Spree.t(:status) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/return_authorization_reasons/_table_row.html.erb b/spree/admin/app/views/spree/admin/return_authorization_reasons/_table_row.html.erbdeleted file mode 100644index a7a91c0772..0000000000--- a/spree/admin/app/views/spree/admin/return_authorization_reasons/_table_row.html.erb+++ /dev/null@@ -1,18 +0,0 @@-<tr id="<%= spree_dom_id return_authorization_reason %>" data-controller="row-link">- <td class="w-40 align-center cursor-pointer" data-action="click->row-link#openLink">- <%= return_authorization_reason.name %>- </td>- <td class="w-20 align-center cursor-pointer" data-action="click->row-link#openLink">- <%= active_badge(- return_authorization_reason.active,- label: Spree.t(return_authorization_reason.active? ? :active : :inactive),- ) %>- </td>- <td class="actions w-10">- <% if return_authorization_reason.mutable? %>- <%= if can? :edit, return_authorization_reason- link_to_edit(return_authorization_reason, no_text: true, data: { row_link_target: :link, turbo_frame: '_top' })- end %>- <% end %>- </td>-</tr>diff --git a/spree/admin/app/views/spree/admin/return_authorization_reasons/index.html.erb b/spree/admin/app/views/spree/admin/return_authorization_reasons/index.html.erbindex 0ed59982a0..5d05bd796a 100644--- a/spree/admin/app/views/spree/admin/return_authorization_reasons/index.html.erb+++ b/spree/admin/app/views/spree/admin/return_authorization_reasons/index.html.erb@@ -7,4 +7,4 @@<%= render_admin_partials(:return_authorization_reasons_header_partials) %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :return_authorization_reasons %>diff --git a/spree/admin/app/views/spree/admin/return_authorizations/_table_header.html.erb b/spree/admin/app/views/spree/admin/return_authorizations/_table_header.html.erbdeleted file mode 100644index 990a10c154..0000000000--- a/spree/admin/app/views/spree/admin/return_authorizations/_table_header.html.erb+++ /dev/null@@ -1,6 +0,0 @@-<tr>- <th scope="col"><%= Spree.t(:number) %></th>- <th scope="col"><%= Spree.t(:created_at) %></th>- <th scope="col"><%= Spree.t(:customer) %></th>- <th class="text-center w-10"><%= Spree.t(:status) %></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/return_authorizations/_table_row.html.erb b/spree/admin/app/views/spree/admin/return_authorizations/_table_row.html.erbdeleted file mode 100644index f81bff01f0..0000000000--- a/spree/admin/app/views/spree/admin/return_authorizations/_table_row.html.erb+++ /dev/null@@ -1,40 +0,0 @@-<% return_url =- (- if can?(:edit, return_authorization)- spree.edit_admin_order_return_authorization_path(- return_authorization,- order_id: return_authorization.order,- )- else- spree.admin_order_return_authorization_path(- return_authorization,- order_id: return_authorization.order,- )- end- ) %>--<tr- id="<%= spree_dom_id return_authorization %>"- data-controller="row-link"- class="cursor-pointer"->- <td data-action="click->row-link#openLink">- <%= link_to return_authorization.number,- return_url,- class: "font-bold",- data: {- row_link_target: :link,- } %>- </td>- <td data-action="click->row-link#openLink">- <%= link_to spree_time_ago(return_authorization.created_at),- return_url,- class: "text-gray-900" %>- </td>- <td data-action="click->row-link#openLink">- <%= render "spree/admin/orders/customer_summary", order: return_authorization.order %>- </td>- <td class="text-center w-10" data-action="click->row-link#openLink">- <span class="badge badge-<%= return_authorization.state %>"><%= Spree.t("return_authorization_states.#{return_authorization.state}") %></span>- </td>-</tr>diff --git a/spree/admin/app/views/spree/admin/return_authorizations/index.html.erb b/spree/admin/app/views/spree/admin/return_authorizations/index.html.erbindex 67271d7d67..e5b7e04bd9 100644--- a/spree/admin/app/views/spree/admin/return_authorizations/index.html.erb+++ b/spree/admin/app/views/spree/admin/return_authorizations/index.html.erb@@ -8,4 +8,4 @@<%= render_admin_partials(:return_authorizations_header_partials) %>-<%= render 'spree/admin/shared/index_table', new_object_url: nil %>+<%= render_table @collection, :return_authorizations %>diff --git a/spree/admin/app/views/spree/admin/shipping_categories/_table_header.html.erb b/spree/admin/app/views/spree/admin/shipping_categories/_table_header.html.erbdeleted file mode 100644index e5aa196048..0000000000--- a/spree/admin/app/views/spree/admin/shipping_categories/_table_header.html.erb+++ /dev/null@@ -1,4 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/shipping_categories/_table_row.html.erb b/spree/admin/app/views/spree/admin/shipping_categories/_table_row.html.erbdeleted file mode 100644index e333dc68ab..0000000000--- a/spree/admin/app/views/spree/admin/shipping_categories/_table_row.html.erb+++ /dev/null@@ -1,8 +0,0 @@-<tr id="<%= spree_dom_id shipping_category %>" class="cursor-pointer" data-controller="row-link">- <td data-action="click->row-link#openLink"><%= shipping_category.name %></td>- <td class="actions">- <span class="flex justify-end">- <%= link_to_edit(shipping_category, data: { row_link_target: :link, turbo_frame: '_top' }) if can? :edit, shipping_category %>- </span>- </td>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/shipping_categories/index.html.erb b/spree/admin/app/views/spree/admin/shipping_categories/index.html.erbindex e953e873c8..88e3477b8a 100644--- a/spree/admin/app/views/spree/admin/shipping_categories/index.html.erb+++ b/spree/admin/app/views/spree/admin/shipping_categories/index.html.erb@@ -11,4 +11,4 @@<%= render partial: 'spree/admin/shared/shipping_nav' %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :shipping_categories %>diff --git a/spree/admin/app/views/spree/admin/shipping_methods/_table_header.html.erb b/spree/admin/app/views/spree/admin/shipping_methods/_table_header.html.erbdeleted file mode 100644index d8778a7671..0000000000--- a/spree/admin/app/views/spree/admin/shipping_methods/_table_header.html.erb+++ /dev/null@@ -1,8 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= Spree.t(:zone) %></th>- <th scope="col"><%= Spree.t(:estimated_delivery_time) %></th>- <th scope="col"><%= Spree.t(:amount) %></th>- <th scope="col"><%= Spree.t(:visibility) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/shipping_methods/_table_row.html.erb b/spree/admin/app/views/spree/admin/shipping_methods/_table_row.html.erbdeleted file mode 100644index 05a3a6daff..0000000000--- a/spree/admin/app/views/spree/admin/shipping_methods/_table_row.html.erb+++ /dev/null@@ -1,33 +0,0 @@-<tr id="<%= spree_dom_id shipping_method %>" class="cursor-pointer" data-controller="row-link">- <td data-action="click->row-link#openLink" class="w-15">- <strong><%= shipping_method.name %></strong>- <% if shipping_method.admin_name.present? %>- <span class="badge badge-light border ml-2">- <%= shipping_method.admin_name %>- </span>- <% end %>- </td>- <td data-action="click->row-link#openLink" class="w-1/4 whitespace-normal">- <% shipping_method.zones.each do |zone| %>- <% if can?(:manage, zone) %>- <%= link_to zone.name, spree.edit_admin_zone_path(zone), class: 'badge badge-light border mb-2' %>- <% else %>- <span class="badge badge-light border mb-2"><%= zone.name %></span>- <% end %>- <% end %>- </td>- <td data-action="click->row-link#openLink" class="w-10">- <%= Spree.t(:display_delivery_range, delivery_range: shipping_method.delivery_range) if shipping_method.delivery_range.present? %>- </td>- <td data-action="click->row-link#openLink" class="w-10">- <%= shipping_method.display_estimated_price.presence || 'Not set' %>- </td>- <td class="w-10">- <%= form_with model: shipping_method, url: spree.admin_shipping_method_path(shipping_method), method: :patch, data: { controller: 'auto-submit' } do |f| %>- <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm', data: { action: 'auto-submit#submit' } } %>- <% end %>- </td>- <td class="actions w-10">- <%= link_to_edit(shipping_method, data: { row_link_target: :link, turbo_frame: '_top' }) if can? :edit, shipping_method %>- </td>-</tr>diff --git a/spree/admin/app/views/spree/admin/shipping_methods/index.html.erb b/spree/admin/app/views/spree/admin/shipping_methods/index.html.erbindex adb9bbd1b8..fc90d83e1d 100644--- a/spree/admin/app/views/spree/admin/shipping_methods/index.html.erb+++ b/spree/admin/app/views/spree/admin/shipping_methods/index.html.erb@@ -17,4 +17,4 @@<%= render_admin_partials(:shipping_methods_header_partials) %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :shipping_methods %>diff --git a/spree/admin/app/views/spree/admin/stock_locations/_table_header.html.erb b/spree/admin/app/views/spree/admin/stock_locations/_table_header.html.erbdeleted file mode 100644index 266bb01819..0000000000--- a/spree/admin/app/views/spree/admin/stock_locations/_table_header.html.erb+++ /dev/null@@ -1,9 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= sort_link @search, :country, Spree.t(:country) %></th>- <th scope="col"><%= Spree.t(:active) %>?</th>- <% if can?(:mark_as_default, Spree::StockLocation) %>- <th scope="col"><%= Spree.t(:default) %>?</th>- <% end %>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/stock_locations/_table_row.html.erb b/spree/admin/app/views/spree/admin/stock_locations/_table_row.html.erbdeleted file mode 100644index c6ec887572..0000000000--- a/spree/admin/app/views/spree/admin/stock_locations/_table_row.html.erb+++ /dev/null@@ -1,36 +0,0 @@-<tr id="<%= spree_dom_id stock_location %>" data-controller="row-link" class="cursor-pointer">- <td data-action="click->row-link#openLink"><%= stock_location.display_name %></td>- <td data-action="click->row-link#openLink">- <%= flag_emoji(stock_location.country_iso) %>- <%= stock_location.country_name %>- </td>- <td data-action="click->row-link#openLink">- <%= active_badge(stock_location.active?) %>- </td>- <% if can?(:mark_as_default, Spree::StockLocation) %>- <td data-action="click->row-link#openLink"><%= active_badge(stock_location.default?) %></td>- <% end %>- <td class="actions">- <% if can? :edit, stock_location %>- <div class="flex justify-end items-center">- <div><%= link_to_edit stock_location, data: { row_link_target: 'link', turbo_frame: '_top' } %></div>-- <% if !stock_location.default? && can?(:mark_as_default, Spree::StockLocation) %>- <%= dropdown do %>- <%= dropdown_toggle class: 'btn-sm h-full' do %>- <%= icon('dots-vertical', class: 'mr-0') %>- <% end %>- <%= dropdown_menu do %>- <%= link_to_with_icon 'check',- Spree.t(:mark_as_default),- spree.mark_as_default_admin_stock_location_path(stock_location),- class: 'dropdown-item',- data: { turbo_method: :put } %>- <% end %>- <% end %>- <% end %>- </div>- </div>- <% end %>- </td>-</tr>diff --git a/spree/admin/app/views/spree/admin/stock_locations/index.html.erb b/spree/admin/app/views/spree/admin/stock_locations/index.html.erbindex 75fac8bacb..7fccb82a1a 100644--- a/spree/admin/app/views/spree/admin/stock_locations/index.html.erb+++ b/spree/admin/app/views/spree/admin/stock_locations/index.html.erb@@ -8,4 +8,4 @@<%= render_admin_partials(:stock_locations_header_partials) %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :stock_locations %>diff --git a/spree/admin/app/views/spree/admin/tax_categories/_table_header.html.erb b/spree/admin/app/views/spree/admin/tax_categories/_table_header.html.erbdeleted file mode 100644index 7adbb32cf9..0000000000--- a/spree/admin/app/views/spree/admin/tax_categories/_table_header.html.erb+++ /dev/null@@ -1,7 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= sort_link @search, :tax_code, Spree.t(:tax_code) %></th>- <th scope="col"><%= Spree.t(:description) %></th>- <th scope="col"><%= Spree.t(:default) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/tax_categories/_table_row.html.erb b/spree/admin/app/views/spree/admin/tax_categories/_table_row.html.erbdeleted file mode 100644index 3c3734096e..0000000000--- a/spree/admin/app/views/spree/admin/tax_categories/_table_row.html.erb+++ /dev/null@@ -1,13 +0,0 @@-<tr id="<%= spree_dom_id tax_category %>" data-controller="row-link" class="cursor-pointer">- <td class="w-20" data-action="click->row-link#openLink"><%= tax_category.name %></td>- <td class="w-20" data-action="click->row-link#openLink">- <% if tax_category.tax_code.present? %>- <code><%= tax_category.tax_code %></code>- <% end %>- </td>- <td class="w-40" data-action="click->row-link#openLink"><%= tax_category.description %></td>- <td class="w-10" data-action="click->row-link#openLink"><%= active_badge(tax_category.is_default?) %></td>- <td class="w-10 actions">- <%= link_to_edit(tax_category, data: { row_link_target: :link, turbo_frame: '_top' }) if can? :edit, tax_category %>- </td>-</tr>diff --git a/spree/admin/app/views/spree/admin/tax_categories/index.html.erb b/spree/admin/app/views/spree/admin/tax_categories/index.html.erbindex eade70f65b..1efc673ffd 100644--- a/spree/admin/app/views/spree/admin/tax_categories/index.html.erb+++ b/spree/admin/app/views/spree/admin/tax_categories/index.html.erb@@ -11,4 +11,4 @@<%= render 'spree/admin/shared/tax_nav' %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :tax_categories %>diff --git a/spree/admin/app/views/spree/admin/tax_rates/_table_header.html.erb b/spree/admin/app/views/spree/admin/tax_rates/_table_header.html.erbdeleted file mode 100644index 8ea47e29e5..0000000000--- a/spree/admin/app/views/spree/admin/tax_rates/_table_header.html.erb+++ /dev/null@@ -1,9 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= Spree.t(:tax_category) %></th>- <th scope="col"><%= Spree.t(:zone) %></th>- <th scope="col"><%= sort_link @search, :amount, Spree.t(:amount) %></th>- <th scope="col"><%= Spree.t(:included_in_price) %></th>- <th scope="col"><%= Spree.t(:show_rate_in_label) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/tax_rates/_table_row.html.erb b/spree/admin/app/views/spree/admin/tax_rates/_table_row.html.erbdeleted file mode 100644index dcff3c2d58..0000000000--- a/spree/admin/app/views/spree/admin/tax_rates/_table_row.html.erb+++ /dev/null@@ -1,15 +0,0 @@-<tr id="<%= spree_dom_id tax_rate %>" data-controller="row-link" class="cursor-pointer">- <td class="w-1/4" data-action="click->row-link#openLink"><%= tax_rate.name %></td>- <td class="w-15" data-action="click->row-link#openLink">- <%= tax_rate.tax_category.try(:name) || Spree.t(:not_available) %>- </td>- <td class="w-15" data-action="click->row-link#openLink">- <%= tax_rate.zone.try(:name) || Spree.t(:not_available) %>- </td>- <td class="w-15" data-action="click->row-link#openLink"><%= number_to_percentage(tax_rate.amount * 100) %></td>- <td class="w-10" data-action="click->row-link#openLink"><%= active_badge(tax_rate.included_in_price?) %></td>- <td class="w-10" data-action="click->row-link#openLink"><%= active_badge(tax_rate.show_rate_in_label?) %></td>- <td class="w-10 actions">- <%= link_to_edit(tax_rate, data: { row_link_target: 'link', turbo_frame: '_top' }) if can? :edit, tax_rate %>- </td>-</tr>diff --git a/spree/admin/app/views/spree/admin/tax_rates/index.html.erb b/spree/admin/app/views/spree/admin/tax_rates/index.html.erbindex 6eb8a0b095..caab9e1458 100644--- a/spree/admin/app/views/spree/admin/tax_rates/index.html.erb+++ b/spree/admin/app/views/spree/admin/tax_rates/index.html.erb@@ -11,4 +11,4 @@<%= render 'spree/admin/shared/tax_nav' %>-<%= render 'spree/admin/shared/index_table' %>+<%= render_table @collection, :tax_rates %>diff --git a/spree/admin/app/views/spree/admin/taxonomies/_table_header.html.erb b/spree/admin/app/views/spree/admin/taxonomies/_table_header.html.erbdeleted file mode 100644index 16f44e5918..0000000000--- a/spree/admin/app/views/spree/admin/taxonomies/_table_header.html.erb+++ /dev/null@@ -1,6 +0,0 @@-<tr data-hook="listing_taxonomies_header">- <th class="no-border handel-head"></th>- <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>- <th scope="col"><%= Spree.t(:taxons) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/taxonomies/_table_row.html.erb b/spree/admin/app/views/spree/admin/taxonomies/_table_row.html.erbdeleted file mode 100644index 32abbd698a..0000000000--- a/spree/admin/app/views/spree/admin/taxonomies/_table_row.html.erb+++ /dev/null@@ -1,16 +0,0 @@-<tr id="<%= spree_dom_id taxonomy %>" data-controller="row-link" data-sortable-update-url="<%= spree.admin_taxonomy_path(taxonomy) %>">- <td class="w-5 move-handle text-center">- <%= icon('grip-vertical', class: 'rounded-md hover:bg-gray-100 p-2') %>- </td>- <td class="w-1/2 cursor-pointer py-0" data-action="click->row-link#openLink">- <%= link_to taxonomy.name, spree.admin_taxonomy_path(taxonomy), class: 'no-underline flex items-center font-bold text-gray-900', data: { row_link_target: :link, turbo_frame: '_top' } %>- </td>- <td class="w-15 cursor-pointer" data-action="click->row-link#openLink">- <!-- We don't want to include the root taxon -->- <%= taxonomy.taxons.count - 1 %>- </td>- <td class="w-30 actions">- <%= link_to_with_icon 'list-tree', Spree.t('admin.manage_taxons'), spree.admin_taxonomy_path(taxonomy), class: 'btn btn-light btn-sm', data: { turbo_frame: '_top' } %>- <%= link_to_edit(taxonomy, class: 'btn btn-light btn-sm', data: { turbo_frame: '_top' }) if can?(:edit, taxonomy) %>- </td>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/taxonomies/index.html.erb b/spree/admin/app/views/spree/admin/taxonomies/index.html.erbindex 6859ed1094..75a8ece4d8 100644--- a/spree/admin/app/views/spree/admin/taxonomies/index.html.erb+++ b/spree/admin/app/views/spree/admin/taxonomies/index.html.erb@@ -9,4 +9,4 @@<%= render_admin_partials(:taxonomies_header_partials) %>-<%= render 'spree/admin/shared/index_table', sortable: true %>+<%= render_table @collection, :taxonomies, sortable: true %>diff --git a/spree/admin/app/views/spree/admin/zones/_table_header.html.erb b/spree/admin/app/views/spree/admin/zones/_table_header.html.erbdeleted file mode 100644index 0d9aa059ca..0000000000--- a/spree/admin/app/views/spree/admin/zones/_table_header.html.erb+++ /dev/null@@ -1,8 +0,0 @@-<tr>- <th scope="col"><%= sort_link @search,:name, Spree.t(:name) %></th>- <th scope="col">- <%= sort_link @search,:description, Spree.t(:description) %>- </th>- <th scope="col"><%= Spree.t(:default_tax_zone) %></th>- <th scope="col"></th>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/zones/_table_row.html.erb b/spree/admin/app/views/spree/admin/zones/_table_row.html.erbdeleted file mode 100644index df61e68828..0000000000--- a/spree/admin/app/views/spree/admin/zones/_table_row.html.erb+++ /dev/null@@ -1,8 +0,0 @@-<tr id="<%= spree_dom_id zone %>" class="cursor-pointer" data-controller="row-link">- <td class="w-1/4" data-action="click->row-link#openLink"><%= zone.name %></td>- <td class="w-40 text-gray-600 whitespace-normal" data-action="click->row-link#openLink"><%= zone.description %></td>- <td class="w-10" data-action="click->row-link#openLink"><%= active_badge(zone.default_tax?) %></td>- <td class="w-10 actions">- <%= link_to_edit(zone, data: { row_link_target: :link, turbo_frame: '_top' }) if can? :edit, zone %>- </td>-</tr>\ No newline at end of filediff --git a/spree/admin/app/views/spree/admin/zones/index.html.erb b/spree/admin/app/views/spree/admin/zones/index.html.erbindex 3b5c446fd3..a4e1057f8e 100644--- a/spree/admin/app/views/spree/admin/zones/index.html.erb+++ b/spree/admin/app/views/spree/admin/zones/index.html.erb@@ -15,4 +15,4 @@<%= render_admin_partials(:zones_header_partials) %>-<%= render 'spree/admin/shared/index_table' %>\ No newline at end of file+<%= render_table @collection, :zones %>\ No newline at end of filediff --git a/spree/admin/config/initializers/spree_admin_tables.rb b/spree/admin/config/initializers/spree_admin_tables.rbindex a8c884b519..5a2ca2bcfe 100644--- a/spree/admin/config/initializers/spree_admin_tables.rb+++ b/spree/admin/config/initializers/spree_admin_tables.rb@@ -1649,4 +1649,353 @@ Rails.application.config.after_initialize dofilterable: false,default: true,position: 30++ # ==========================================+ # Register Shipping Categories table+ # ==========================================+ Spree.admin.tables.register(:shipping_categories, model_class: Spree::ShippingCategory, search_param: :name_cont)++ Spree.admin.tables.shipping_categories.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ # ==========================================+ # Register Refund Reasons table+ # ==========================================+ Spree.admin.tables.register(:refund_reasons, model_class: Spree::RefundReason, search_param: :name_cont)++ Spree.admin.tables.refund_reasons.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.refund_reasons.add :active,+ label: :status,+ type: :status,+ sortable: false,+ default: true,+ position: 20,+ method: ->(r) { r.active? ? 'active' : 'inactive' }++ Spree.admin.tables.refund_reasons.add :mutable,+ label: :mutable,+ type: :boolean,+ sortable: false,+ default: true,+ position: 30++ # ==========================================+ # Register Return Authorization Reasons table+ # ==========================================+ Spree.admin.tables.register(:return_authorization_reasons, model_class: Spree::ReturnAuthorizationReason, search_param: :name_cont)++ Spree.admin.tables.return_authorization_reasons.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.return_authorization_reasons.add :active,+ label: :status,+ type: :status,+ sortable: false,+ default: true,+ position: 20,+ method: ->(r) { r.active? ? 'active' : 'inactive' }++ # ==========================================+ # Register Reimbursement Types table+ # ==========================================+ Spree.admin.tables.register(:reimbursement_types, model_class: Spree::ReimbursementType, search_param: :name_cont)++ Spree.admin.tables.reimbursement_types.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10,+ method: ->(rt) { rt.name.humanize }++ Spree.admin.tables.reimbursement_types.add :type,+ label: :type,+ type: :string,+ sortable: false,+ default: true,+ position: 20,+ method: ->(rt) { rt.type.demodulize }++ Spree.admin.tables.reimbursement_types.add :active,+ label: :status,+ type: :status,+ sortable: false,+ default: true,+ position: 30,+ method: ->(r) { r.active? ? 'active' : 'inactive' }++ Spree.admin.tables.reimbursement_types.add :mutable,+ label: :mutable,+ type: :boolean,+ sortable: false,+ default: true,+ position: 40++ # ==========================================+ # Register Zones table+ # ==========================================+ Spree.admin.tables.register(:zones, model_class: Spree::Zone, search_param: :name_cont)++ Spree.admin.tables.zones.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.zones.add :description,+ label: :description,+ type: :string,+ sortable: true,+ default: true,+ position: 20++ Spree.admin.tables.zones.add :default_tax,+ label: :default_tax_zone,+ type: :boolean,+ sortable: false,+ default: true,+ position: 30++ # ==========================================+ # Register Tax Categories table+ # ==========================================+ Spree.admin.tables.register(:tax_categories, model_class: Spree::TaxCategory, search_param: :name_cont)++ Spree.admin.tables.tax_categories.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.tax_categories.add :tax_code,+ label: :tax_code,+ type: :string,+ sortable: true,+ filterable: true,+ default: true,+ position: 20++ Spree.admin.tables.tax_categories.add :description,+ label: :description,+ type: :string,+ sortable: false,+ default: true,+ position: 30++ Spree.admin.tables.tax_categories.add :is_default,+ label: :default,+ type: :boolean,+ sortable: false,+ default: true,+ position: 40++ # ==========================================+ # Register Tax Rates table+ # ==========================================+ Spree.admin.tables.register(:tax_rates, model_class: Spree::TaxRate, search_param: :name_cont)++ Spree.admin.tables.tax_rates.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.tax_rates.add :tax_category,+ label: :tax_category,+ type: :string,+ sortable: false,+ default: true,+ position: 20,+ method: ->(tr) { tr.tax_category&.name }++ Spree.admin.tables.tax_rates.add :zone,+ label: :zone,+ type: :string,+ sortable: false,+ default: true,+ position: 30,+ method: ->(tr) { tr.zone&.name }++ Spree.admin.tables.tax_rates.add :amount,+ label: :amount,+ type: :string,+ sortable: true,+ default: true,+ position: 40,+ method: ->(tr) { number_to_percentage(tr.amount * 100) }++ Spree.admin.tables.tax_rates.add :included_in_price,+ label: :included_in_price,+ type: :boolean,+ sortable: false,+ default: true,+ position: 50++ Spree.admin.tables.tax_rates.add :show_rate_in_label,+ label: :show_rate_in_label,+ type: :boolean,+ sortable: false,+ default: true,+ position: 60++ # ==========================================+ # Register Taxonomies table+ # ==========================================+ Spree.admin.tables.register(:taxonomies, model_class: Spree::Taxonomy, search_param: :name_cont)++ Spree.admin.tables.taxonomies.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.taxonomies.add :taxons_count,+ label: :taxons,+ type: :string,+ sortable: false,+ default: true,+ position: 20,+ method: ->(taxonomy) { taxonomy.taxons.count - 1 }++ # ==========================================+ # Register Stock Locations table+ # ==========================================+ Spree.admin.tables.register(:stock_locations, model_class: Spree::StockLocation, search_param: :name_cont)++ Spree.admin.tables.stock_locations.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10,+ method: ->(sl) { sl.display_name }++ Spree.admin.tables.stock_locations.add :country,+ label: :country,+ type: :string,+ sortable: false,+ default: true,+ position: 20,+ method: ->(sl) { sl.country_name }++ Spree.admin.tables.stock_locations.add :active,+ label: :active,+ type: :boolean,+ sortable: false,+ default: true,+ position: 30++ Spree.admin.tables.stock_locations.add :default,+ label: :default,+ type: :boolean,+ sortable: false,+ default: true,+ position: 40++ # ==========================================+ # Register Return Authorizations table+ # ==========================================+ Spree.admin.tables.register(:return_authorizations, model_class: Spree::ReturnAuthorization, search_param: :number_cont, new_resource: false)++ Spree.admin.tables.return_authorizations.add :number,+ label: :number,+ type: :string,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.return_authorizations.add :created_at,+ label: :created_at,+ type: :datetime,+ sortable: true,+ default: true,+ position: 20++ Spree.admin.tables.return_authorizations.add :state,+ label: :status,+ type: :status,+ sortable: false,+ default: true,+ position: 30++ # ==========================================+ # Register Shipping Methods table+ # ==========================================+ Spree.admin.tables.register(:shipping_methods, model_class: Spree::ShippingMethod, search_param: :name_cont)++ Spree.admin.tables.shipping_methods.add :name,+ label: :name,+ type: :link,+ sortable: true,+ filterable: true,+ default: true,+ position: 10++ Spree.admin.tables.shipping_methods.add :admin_name,+ label: :admin_name,+ type: :string,+ sortable: false,+ default: true,+ position: 20++ Spree.admin.tables.shipping_methods.add :zones,+ label: :zones,+ type: :string,+ sortable: false,+ default: true,+ position: 30,+ wrap: true,+ method: ->(sm) { sm.zones.map(&:name).join(', ') }++ Spree.admin.tables.shipping_methods.add :delivery_range,+ label: :estimated_delivery_time,+ type: :string,+ sortable: false,+ default: true,+ position: 40,+ method: ->(sm) { sm.delivery_range.present? ? Spree.t(:display_delivery_range, delivery_range: sm.delivery_range) : nil }++ Spree.admin.tables.shipping_methods.add :estimated_price,+ label: :amount,+ type: :string,+ sortable: false,+ default: true,+ position: 50,+ method: ->(sm) { sm.display_estimated_price }++ Spree.admin.tables.shipping_methods.add :display_on,+ label: :visibility,+ type: :status,+ sortable: false,+ default: true,+ position: 60,+ method: ->(sm) { sm.display_on.presence || 'both' }enddiff --git a/spree/admin/spec/features/spree/admin/settings/shipping_categories_spec.rb b/spree/admin/spec/features/spree/admin/settings/shipping_categories_spec.rbindex 74501b0e7d..a04fe3a45a 100644--- a/spree/admin/spec/features/spree/admin/settings/shipping_categories_spec.rb+++ b/spree/admin/spec/features/spree/admin/settings/shipping_categories_spec.rb@@ -25,7 +25,7 @@ RSpec.feature 'Shipping categories' doshipping_category = create(:shipping_category, name: 'Standard')visit spree.admin_shipping_categories_path- click_on 'Edit'+ click_on shipping_category.namefill_in 'Name', with: 'Express'@@ -42,7 +42,7 @@ RSpec.feature 'Shipping categories' doshipping_category = create(:shipping_category, name: 'Standard')visit spree.admin_shipping_categories_path- click_on 'Edit'+ click_on shipping_category.namewait_for_turboaccept_turbo_confirm dodiff --git a/spree/admin/spec/features/spree/admin/settings/tax_categories_spec.rb b/spree/admin/spec/features/spree/admin/settings/tax_categories_spec.rbindex 5582f45cf5..11a8b65705 100644--- a/spree/admin/spec/features/spree/admin/settings/tax_categories_spec.rb+++ b/spree/admin/spec/features/spree/admin/settings/tax_categories_spec.rb@@ -37,7 +37,7 @@ RSpec.feature 'Tax categories' do)visit spree.admin_tax_categories_path- click_on 'Edit'+ click_on tax_category.namefill_in 'Name', with: 'Non-Taxable'fill_in 'Description', with: 'Non-Taxable Tax Category'@@ -58,10 +58,10 @@ RSpec.feature 'Tax categories' doendit 'allows to delete tax category', js: true do- create(:tax_category)+ tax_category = create(:tax_category)visit spree.admin_tax_categories_path- click_on 'Edit'+ click_on tax_category.namewait_for_turboaccept_turbo_confirm dodiff --git a/spree/admin/spec/features/spree/admin/settings/tax_rates_spec.rb b/spree/admin/spec/features/spree/admin/settings/tax_rates_spec.rbindex 4bf1a09207..165f28806b 100644--- a/spree/admin/spec/features/spree/admin/settings/tax_rates_spec.rb+++ b/spree/admin/spec/features/spree/admin/settings/tax_rates_spec.rb@@ -52,7 +52,7 @@ RSpec.feature 'Tax Rates', js: true do)visit spree.admin_tax_rates_path- click_on 'Edit'+ click_on tax_rate.namefill_in 'Name', with: 'Updated Tax Rate'fill_in 'Rate', with: 20@@ -81,7 +81,7 @@ RSpec.feature 'Tax Rates', js: true dotax_rate = create(:tax_rate)visit spree.admin_tax_rates_path- click_on 'Edit'+ click_on tax_rate.namewait_for_turboaccept_turbo_confirm dodiff --git a/spree/admin/spec/helpers/spree/admin/table_helper_spec.rb b/spree/admin/spec/helpers/spree/admin/table_helper_spec.rbindex 81e386897b..cf81d0ed2d 100644--- a/spree/admin/spec/helpers/spree/admin/table_helper_spec.rb+++ b/spree/admin/spec/helpers/spree/admin/table_helper_spec.rb@@ -165,12 +165,12 @@ RSpec.describe Spree::Admin::TableHelper, type: :helper doexpect(result).to include('badge-inactive')end- it 'renders unknown status with badge-secondary class' do+ it 'renders unknown status with badge-light class' doallow(product).to receive(:status).and_return('custom_status')result = helper.render_column_value(product, column, table)- expect(result).to include('badge-secondary')+ expect(result).to include('badge-light')endit 'renders dash for blank value' do@@ -418,7 +418,7 @@ RSpec.describe Spree::Admin::TableHelper, type: :helper doit 'applies secondary class for unknown statuses' doresult = helper.render_status_column('custom', column)- expect(result).to include('badge-secondary')+ expect(result).to include('badge-light')endend@@ -467,12 +467,12 @@ RSpec.describe Spree::Admin::TableHelper, type: :helper doenddescribe '#column_cell_class' do- it 'returns empty string for left-aligned column (default)' do+ it 'returns text-nowrap for left-aligned column (default)' docolumn = Spree::Admin::Table::Column.new(key: 'name', label: :name, align: 'left')result = helper.column_cell_class(column)- expect(result).to eq('')+ expect(result).to eq('text-nowrap')endit 'returns text alignment class for right alignment' do@@ -481,6 +481,16 @@ RSpec.describe Spree::Admin::TableHelper, type: :helper doresult = helper.column_cell_class(column)expect(result).to include('text-right')+ expect(result).to include('text-nowrap')+ end++ it 'returns text-wrap when wrap is true' do+ column = Spree::Admin::Table::Column.new(key: 'description', label: :description, wrap: true)++ result = helper.column_cell_class(column)++ expect(result).to include('text-wrap')+ expect(result).not_to include('text-nowrap')endend