diff --git a/admin/app/components/solidus_admin/option_types/index/component.rb b/admin/app/components/solidus_admin/option_types/index/component.rb
index 24f6b24e4cf..ef41488c353 100644
--- a/admin/app/components/solidus_admin/option_types/index/component.rb
+++ b/admin/app/components/solidus_admin/option_types/index/component.rb
@@ -55,7 +55,7 @@ def name_column
{
header: :name,
data: ->(option_type) do
- content_tag :div, option_type.name
+ link_to option_type.name, row_url(option_type), class: "underline cursor-pointer"
end
}
end
@@ -64,7 +64,7 @@ def presentation_column
{
header: :presentation,
data: ->(option_type) do
- content_tag :div, option_type.presentation
+ link_to option_type.presentation, row_url(option_type), class: "underline cursor-pointer"
end
}
end
diff --git a/admin/app/components/solidus_admin/orders/index/component.rb b/admin/app/components/solidus_admin/orders/index/component.rb
index 2c8641926f5..455e66bef9d 100644
--- a/admin/app/components/solidus_admin/orders/index/component.rb
+++ b/admin/app/components/solidus_admin/orders/index/component.rb
@@ -106,9 +106,9 @@ def number_column
header: :order,
data: ->(order) do
if !row_fade(order)
- content_tag :div, order.number, class: 'font-semibold'
+ link_to order.number, row_url(order), class: "font-semibold underline cursor-pointer"
else
- content_tag :div, order.number
+ link_to order.number, row_url(order), class: "underline cursor-pointer"
end
end
}
diff --git a/admin/app/components/solidus_admin/payment_methods/index/component.rb b/admin/app/components/solidus_admin/payment_methods/index/component.rb
index 7bf64ffa63f..c75dfde3bf5 100644
--- a/admin/app/components/solidus_admin/payment_methods/index/component.rb
+++ b/admin/app/components/solidus_admin/payment_methods/index/component.rb
@@ -59,13 +59,13 @@ def columns
{
header: :name,
data: ->(payment_method) do
- content_tag :div, payment_method.name
+ link_to payment_method.name, row_url(payment_method), class: "underline cursor-pointer"
end
},
{
header: :type,
data: ->(payment_method) do
- content_tag :div, payment_method.model_name.human
+ link_to payment_method.model_name.human, row_url(payment_method), class: "underline cursor-pointer"
end
},
{
diff --git a/admin/app/components/solidus_admin/products/index/component.rb b/admin/app/components/solidus_admin/products/index/component.rb
index 6a015ebcbd2..3e43aa87364 100644
--- a/admin/app/components/solidus_admin/products/index/component.rb
+++ b/admin/app/components/solidus_admin/products/index/component.rb
@@ -106,7 +106,7 @@ def name_column
{
header: :name,
data: ->(product) do
- content_tag :div, product.name
+ link_to product.name, row_url(product), class: "underline cursor-pointer"
end
}
end
diff --git a/admin/app/components/solidus_admin/properties/index/component.rb b/admin/app/components/solidus_admin/properties/index/component.rb
index e8289365922..3c4a5c7907e 100644
--- a/admin/app/components/solidus_admin/properties/index/component.rb
+++ b/admin/app/components/solidus_admin/properties/index/component.rb
@@ -48,7 +48,7 @@ def name_column
{
header: :name,
data: ->(property) do
- content_tag :div, property.name
+ link_to property.name, row_url(property), class: "underline cursor-pointer"
end
}
end
@@ -57,7 +57,7 @@ def presentation_column
{
header: :presentation,
data: ->(property) do
- content_tag :div, property.presentation
+ link_to property.presentation, row_url(property), class: "underline cursor-pointer"
end
}
end
diff --git a/admin/app/components/solidus_admin/reimbursement_types/index/component.rb b/admin/app/components/solidus_admin/reimbursement_types/index/component.rb
index 39ea3bc77e7..a062e266516 100644
--- a/admin/app/components/solidus_admin/reimbursement_types/index/component.rb
+++ b/admin/app/components/solidus_admin/reimbursement_types/index/component.rb
@@ -15,7 +15,12 @@ def search_key
def columns
[
- :name,
+ {
+ header: :name,
+ data: ->(reimbursement_type) do
+ reimbursement_type.name
+ end
+ },
{
header: :active,
data: ->(reimbursement_type) do
diff --git a/admin/app/components/solidus_admin/stock_items/index/component.rb b/admin/app/components/solidus_admin/stock_items/index/component.rb
index fc20bb93f71..f2a45c05524 100644
--- a/admin/app/components/solidus_admin/stock_items/index/component.rb
+++ b/admin/app/components/solidus_admin/stock_items/index/component.rb
@@ -90,7 +90,7 @@ def name_column
{
header: :name,
data: ->(stock_item) do
- content_tag :div, stock_item.variant.name
+ link_to stock_item.variant.name, row_url(stock_item), class: "underline cursor-pointer"
end
}
end
@@ -99,7 +99,7 @@ def sku_column
{
header: :sku,
data: ->(stock_item) do
- content_tag :div, stock_item.variant.sku
+ link_to stock_item.variant.sku, row_url(stock_item), class: "underline cursor-pointer"
end
}
end
@@ -122,7 +122,9 @@ def variant_column
def stock_location_column
{
header: :stock_location,
- data: ->(stock_item) { stock_item.stock_location.name },
+ data: ->(stock_item) do
+ content_tag :div, stock_item.stock_location.name
+ end
}
end
diff --git a/admin/app/components/solidus_admin/stores/index/component.rb b/admin/app/components/solidus_admin/stores/index/component.rb
index 5df8aa80005..62552e6583d 100644
--- a/admin/app/components/solidus_admin/stores/index/component.rb
+++ b/admin/app/components/solidus_admin/stores/index/component.rb
@@ -44,7 +44,7 @@ def columns
{
header: :slug,
data: ->(store) do
- content_tag :div, store.code
+ link_to store.code, row_url(store), class: "underline cursor-pointer"
end
},
{
diff --git a/admin/app/components/solidus_admin/taxonomies/index/component.rb b/admin/app/components/solidus_admin/taxonomies/index/component.rb
index e1a47ae8f60..d0205cf9388 100644
--- a/admin/app/components/solidus_admin/taxonomies/index/component.rb
+++ b/admin/app/components/solidus_admin/taxonomies/index/component.rb
@@ -46,7 +46,7 @@ def name_column
{
header: :name,
data: ->(taxonomy) do
- content_tag :div, taxonomy.name
+ link_to taxonomy.name, row_url(taxonomy), class: "underline cursor-pointer"
end
}
end
diff --git a/admin/app/components/solidus_admin/ui/table/component.html.erb b/admin/app/components/solidus_admin/ui/table/component.html.erb
index 69a155cd66d..9e685cbcbf2 100644
--- a/admin/app/components/solidus_admin/ui/table/component.html.erb
+++ b/admin/app/components/solidus_admin/ui/table/component.html.erb
@@ -138,15 +138,11 @@
>
<% @data.rows.each do |row| %>
- data-action="click-><%= stimulus_id %>#rowClicked"
- data-<%= stimulus_id %>-url-param="<%= @data.url.call(row) %>"
- <%= "data-sortable-url=#{@sortable.url.call(row)}" if @sortable&.url %>
- <% end %>
+ class="border-b border-gray-100 last:border-0 hover:bg-gray-50 <%= 'bg-gray-15 text-gray-700' if @data.fade&.call(row) %>"
+ <%= "data-sortable-url=#{@sortable.url.call(row)}" if @sortable&.url %>
>
<% @data.columns.each do |column| %>
- <%= render_data_cell(column, row) %>
+ <%= render_data_cell(column, row, @data.url&.call(row)) %>
<% end %>
<% end %>
diff --git a/admin/app/components/solidus_admin/ui/table/component.js b/admin/app/components/solidus_admin/ui/table/component.js
index 66837d4ce75..5d351af7659 100644
--- a/admin/app/components/solidus_admin/ui/table/component.js
+++ b/admin/app/components/solidus_admin/ui/table/component.js
@@ -98,21 +98,11 @@ export default class extends Controller {
}
rowClicked(event) {
- // If the user clicked on a link, button, input or summary, skip the row url visit
+ // Skip if the user clicked on a link, button, input or summary
if (event.target.closest("td").contains(event.target.closest("a,select,textarea,button,input,summary"))) return
if (this.modeValue === "batch") {
this.toggleCheckbox(event.currentTarget)
- } else {
- const url = new URL(event.params.url, "http://dummy.com")
- const params = new URLSearchParams(url.search)
- const frameId = params.get('_turbo_frame')
- const frame = frameId ? { frame: frameId } : {}
- // remove the custom _turbo_frame param from url search:
- params.delete('_turbo_frame')
- url.search = params.toString()
-
- window.Turbo.visit(url.pathname + url.search, frame)
}
}
diff --git a/admin/app/components/solidus_admin/ui/table/component.rb b/admin/app/components/solidus_admin/ui/table/component.rb
index 79e08f9d494..b41c505c0c5 100644
--- a/admin/app/components/solidus_admin/ui/table/component.rb
+++ b/admin/app/components/solidus_admin/ui/table/component.rb
@@ -158,10 +158,10 @@ def render_header_cell(cell, **attrs)
}, **attrs)
end
- def render_data_cell(column, data)
+ def render_data_cell(column, data, url = nil)
cell = column.data
cell = cell.call(data) if cell.respond_to?(:call)
- cell = data.public_send(cell) if cell.is_a?(Symbol)
+ cell = link_to data.public_send(cell), url, class: "underline cursor-pointer" if cell.is_a?(Symbol)
cell = cell.render_in(self) if cell.respond_to?(:render_in)
cell = tag.div(cell, class: "flex items-center gap-1.5 justify-start overflow-x-hidden") if column.wrap
diff --git a/admin/app/components/solidus_admin/users/index/component.rb b/admin/app/components/solidus_admin/users/index/component.rb
index 9a2041936e3..ff7d0814367 100644
--- a/admin/app/components/solidus_admin/users/index/component.rb
+++ b/admin/app/components/solidus_admin/users/index/component.rb
@@ -83,15 +83,21 @@ def columns
},
{
header: :order_count,
- data: ->(user) { user.order_count },
+ data: ->(user) do
+ content_tag :div, user.order_count
+ end
},
{
header: :lifetime_value,
- data: -> { _1.display_lifetime_value.to_html },
+ data: ->(user) do
+ content_tag :div, user.display_lifetime_value.to_html
+ end
},
{
header: :last_active,
- data: ->(user) { last_login(user) },
+ data: ->(user) do
+ content_tag :div, last_login(user)
+ end
},
]
end
diff --git a/admin/app/components/solidus_admin/users/items/component.rb b/admin/app/components/solidus_admin/users/items/component.rb
index f86628d6c0d..41622d72d1a 100644
--- a/admin/app/components/solidus_admin/users/items/component.rb
+++ b/admin/app/components/solidus_admin/users/items/component.rb
@@ -149,7 +149,7 @@ def number_column
col: { class: "w-[18%]" },
header: t(".number_column_header"),
data: ->(item) do
- content_tag :div, item.order.number, class: "font-semibold text-sm"
+ link_to item.order.number, row_url(item.order), class: "underline cursor-pointer font-semibold text-sm"
end
}
end
@@ -164,7 +164,7 @@ def item_name_with_variant_and_sku(item)
# The `.html_safe` is required for the description to display as desired.
# rubocop:disable Rails/OutputSafety
- safe_join([content_tag(:div, content.join("
").html_safe, class: "text-sm")])
+ safe_join([link_to(content.join("
").html_safe, row_url(item.order), class: "underline cursor-pointer text-sm")])
# rubocop:enable Rails/OutputSafety
end
end
diff --git a/admin/app/components/solidus_admin/users/orders/component.rb b/admin/app/components/solidus_admin/users/orders/component.rb
index d2b80caf14d..1f65c5f3c88 100644
--- a/admin/app/components/solidus_admin/users/orders/component.rb
+++ b/admin/app/components/solidus_admin/users/orders/component.rb
@@ -70,9 +70,9 @@ def number_column
header: :order,
data: ->(order) do
if !row_fade(order)
- content_tag :div, order.number, class: 'font-semibold'
+ link_to order.number, row_url(order), class: "font-semibold underline cursor-pointer"
else
- content_tag :div, order.number
+ link_to order.number, row_url(order), class: "underline cursor-pointer"
end
end
}
diff --git a/admin/app/components/solidus_admin/users/store_credits/index/component.rb b/admin/app/components/solidus_admin/users/store_credits/index/component.rb
index e039fd8cc6d..7ccac4b1e7e 100644
--- a/admin/app/components/solidus_admin/users/store_credits/index/component.rb
+++ b/admin/app/components/solidus_admin/users/store_credits/index/component.rb
@@ -56,21 +56,21 @@ def columns
header: :credited,
col: { class: "w-[12%]" },
data: ->(store_credit) do
- content_tag :div, store_credit.display_amount.to_html, class: "text-sm"
+ link_to store_credit.display_amount.to_html, row_url(store_credit), class: "text-sm underline cursor-pointer"
end
},
{
header: :authorized,
col: { class: "w-[13%]" },
data: ->(store_credit) do
- content_tag :div, store_credit.display_amount_authorized.to_html, class: "text-sm"
+ link_to store_credit.display_amount_authorized.to_html, row_url(store_credit), class: "text-sm underline cursor-pointer"
end
},
{
header: :used,
col: { class: "w-[9%]" },
data: ->(store_credit) do
- content_tag :div, store_credit.display_amount_used.to_html, class: "text-sm"
+ link_to store_credit.display_amount_used.to_html, row_url(store_credit), class: "text-sm underline cursor-pointer"
end
},
{
@@ -90,9 +90,7 @@ def columns
{
header: :issued_on,
col: { class: "w-[16%]" },
- data: ->(store_credit) do
- I18n.l(store_credit.created_at.to_date)
- end
+ data: ->(store_credit) { I18n.l(store_credit.created_at.to_date) }
},
{
header: :invalidated,
diff --git a/admin/app/controllers/solidus_admin/stock_items_controller.rb b/admin/app/controllers/solidus_admin/stock_items_controller.rb
index 1333dbe672c..e7606ae5a91 100644
--- a/admin/app/controllers/solidus_admin/stock_items_controller.rb
+++ b/admin/app/controllers/solidus_admin/stock_items_controller.rb
@@ -30,11 +30,13 @@ def update
@stock_item.stock_movements.build(quantity: quantity_adjustment, originator: current_solidus_admin_user)
if @stock_item.save
+ binding.pry
respond_to do |format|
format.html { redirect_to solidus_admin.stock_items_path, status: :see_other }
format.turbo_stream { render turbo_stream: '' }
end
else
+ binding.pry
respond_to do |format|
format.html { render component('stock_items/edit').new(stock_item: @stock_item, page: @page), status: :unprocessable_entity }
end
diff --git a/admin/spec/features/adjustment_reasons_spec.rb b/admin/spec/features/adjustment_reasons_spec.rb
index 8af9a711ea0..9f8c6f8d93d 100644
--- a/admin/spec/features/adjustment_reasons_spec.rb
+++ b/admin/spec/features/adjustment_reasons_spec.rb
@@ -68,7 +68,7 @@
before do
Spree::AdjustmentReason.create(name: "Good Reason", code: 5999)
visit "/admin/adjustment_reasons#{query}"
- find_row("Good Reason").click
+ within("table tbody") { click_on "Good Reason" }
expect(page).to have_content("Edit Adjustment Reason")
expect(page).to be_axe_clean
end
diff --git a/admin/spec/features/refund_reasons_spec.rb b/admin/spec/features/refund_reasons_spec.rb
index ae5a52663eb..ac2f58c576b 100644
--- a/admin/spec/features/refund_reasons_spec.rb
+++ b/admin/spec/features/refund_reasons_spec.rb
@@ -65,7 +65,7 @@
before do
Spree::RefundReason.create(name: "Return process")
visit "/admin/refund_reasons#{query}"
- find_row("Return process").click
+ within("table tbody") { click_on "Return process" }
expect(page).to have_content("Edit Refund Reason")
expect(page).to be_axe_clean
end
diff --git a/admin/spec/features/return_reasons_spec.rb b/admin/spec/features/return_reasons_spec.rb
index 5932101bf41..7c639c211d1 100644
--- a/admin/spec/features/return_reasons_spec.rb
+++ b/admin/spec/features/return_reasons_spec.rb
@@ -67,7 +67,7 @@
before do
Spree::ReturnReason.create(name: "Good Reason")
visit "/admin/return_reasons#{query}"
- find_row("Good Reason").click
+ within("table tbody") { click_on "Good Reason" }
expect(page).to have_content("Edit Return Reason")
expect(page).to be_axe_clean
end
diff --git a/admin/spec/features/roles_spec.rb b/admin/spec/features/roles_spec.rb
index 0132e2ed205..76af54b7942 100644
--- a/admin/spec/features/roles_spec.rb
+++ b/admin/spec/features/roles_spec.rb
@@ -120,7 +120,7 @@
before do
Spree::Role.create(name: "Reviewer", permission_sets: [settings_edit_permission])
visit "/admin/roles#{query}"
- find_row("Reviewer").click
+ within("table tbody") { click_on "Reviewer" }
expect(page).to have_content("Edit Role")
expect(page).to be_axe_clean
expect(Spree::Role.find_by(name: "Reviewer").permission_set_ids)
diff --git a/admin/spec/features/shipping_categories_spec.rb b/admin/spec/features/shipping_categories_spec.rb
index 674ce76a00d..ad231a64d8d 100644
--- a/admin/spec/features/shipping_categories_spec.rb
+++ b/admin/spec/features/shipping_categories_spec.rb
@@ -65,7 +65,7 @@
before do
Spree::ShippingCategory.create(name: "Letter Mail")
visit "/admin/shipping_categories#{query}"
- find_row("Letter Mail").click
+ within("table tbody") { click_on "Letter Mail" }
expect(page).to have_content("Edit Shipping Category")
expect(page).to be_axe_clean
end
diff --git a/admin/spec/features/stock_items_spec.rb b/admin/spec/features/stock_items_spec.rb
index 6e07172fb62..d77d0bb6fe4 100644
--- a/admin/spec/features/stock_items_spec.rb
+++ b/admin/spec/features/stock_items_spec.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'spec_helper'
+require 'pry'
describe "Stock Items", :js, type: :feature do
before { sign_in create(:admin_user, email: 'admin@example.com') }
diff --git a/admin/spec/features/store_credit_reasons_spec.rb b/admin/spec/features/store_credit_reasons_spec.rb
index b4b2c46aff4..ffca0c48e37 100644
--- a/admin/spec/features/store_credit_reasons_spec.rb
+++ b/admin/spec/features/store_credit_reasons_spec.rb
@@ -65,7 +65,8 @@
before do
Spree::StoreCreditReason.create(name: "New Customer Reward")
visit "/admin/store_credit_reasons#{query}"
- find_row("New Customer Reward").click
+ within("table tbody") { click_on "New Customer Reward" }
+
expect(page).to have_content("Edit Store Credit Reason")
expect(page).to be_axe_clean
end
diff --git a/admin/spec/features/users_spec.rb b/admin/spec/features/users_spec.rb
index b19e31b1e9c..db6db480234 100644
--- a/admin/spec/features/users_spec.rb
+++ b/admin/spec/features/users_spec.rb
@@ -65,7 +65,7 @@
create(:user, email: "customer@example.com")
visit "/admin/users"
- find_row("customer@example.com").click
+ within("table tbody") { click_on "customer@example.com" }
end
it "shows the edit page" do
@@ -114,7 +114,7 @@
before do
create(:user_with_addresses, email: "customer@example.com")
visit "/admin/users"
- find_row("customer@example.com").click
+ within("table tbody") { click_on "customer@example.com" }
click_on "Addresses"
end
@@ -167,7 +167,7 @@
before do
create(:user, email: "customer@example.com")
visit "/admin/users"
- find_row("customer@example.com").click
+ within("table tbody") { click_on "customer@example.com" }
click_on "Order History"
end
@@ -187,7 +187,7 @@
before do
create(:user, :with_orders, email: "loyal_customer@example.com")
visit "/admin/users"
- find_row("loyal_customer@example.com").click
+ within("table tbody") { click_on "loyal_customer@example.com" }
click_on "Order History"
end
@@ -212,7 +212,7 @@
before do
create(:user, email: "customer@example.com")
visit "/admin/users"
- find_row("customer@example.com").click
+ within("table tbody") { click_on "customer@example.com" }
click_on "Items"
end
@@ -232,7 +232,7 @@
before do
create(:order_with_line_items, user: create(:user, email: "loyal_customer@example.com"))
visit "/admin/users"
- find_row("loyal_customer@example.com").click
+ within("table tbody") { click_on "loyal_customer@example.com" }
click_on "Items"
end
@@ -258,7 +258,7 @@
before do
create(:user, email: "customer@example.com")
visit "/admin/users"
- find_row("customer@example.com").click
+ within("table tbody") { click_on "customer@example.com" }
click_on "Store Credit"
end
@@ -281,7 +281,8 @@
store_credit.user.update(email: "customer@example.com")
visit "/admin/users"
- find_row("customer@example.com").click
+ within("table tbody") { click_on "customer@example.com" }
+
click_on "Store Credit"
end
diff --git a/admin/spec/spec_helper.rb b/admin/spec/spec_helper.rb
index 70ecb0c11f7..71edce4e804 100644
--- a/admin/spec/spec_helper.rb
+++ b/admin/spec/spec_helper.rb
@@ -45,14 +45,14 @@
Capybara.disable_animation = true
Capybara.register_driver :selenium_chrome_headless do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
- browser_options.args << '--headless'
+ # browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
browser_options.args << '--window-size=1920,1080'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
Capybara.register_driver :selenium_chrome_headless_docker_friendly do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
- browser_options.args << '--headless'
+ # browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
# Sandbox cannot be used inside unprivileged Docker container
browser_options.args << '--no-sandbox'
diff --git a/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb b/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb
index b6fe1730f7e..aa8bebd85dd 100644
--- a/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb
+++ b/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb
@@ -63,7 +63,7 @@ def columns
{
header: :name,
data: ->(promotion) do
- content_tag :div, promotion.name
+ link_to promotion.name, row_url(promotion), class: "underline cursor-pointer"
end
},
{
diff --git a/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb b/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb
index 8416e5d343c..ff09b39c924 100644
--- a/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb
+++ b/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb
@@ -63,7 +63,7 @@ def columns
{
header: :name,
data: ->(promotion) do
- link_to promotion.name, row_url(promotion)
+ link_to promotion.name, row_url(promotion), class: "underline cursor-pointer"
end
},
{