From 7bcdb6a9db3de3028f86c7f3920dc2b6ff69af13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 13 Dec 2022 16:26:27 +0100 Subject: [PATCH] Use the tenant URL as a link to the tenant In general, we don't use links inside admin tables because we don't know where the link will point to, and use "view" actions/links instead. However, in this case, we're showing a URL, so it's perfectly obvious where the link will point to. And so it makes sense to use the URL as a link instead of using a "view" action/link. --- .../admin/tenants/index_component.html.erb | 6 ++---- spec/system/admin/tenants_spec.rb | 14 +++----------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/components/admin/tenants/index_component.html.erb b/app/components/admin/tenants/index_component.html.erb index 655603ddc..ad5f43ea9 100644 --- a/app/components/admin/tenants/index_component.html.erb +++ b/app/components/admin/tenants/index_component.html.erb @@ -17,11 +17,9 @@ <%= tenant.name %> <%= tenant.schema %> - <%= tenant.host %> + <%= link_to tenant.host, root_url(host: tenant.host) %> - <%= render Admin::TableActionsComponent.new(tenant, actions: [:edit]) do |actions| %> - <%= actions.action(:show, text: t("admin.shared.view"), path: root_url(host: tenant.host)) %> - <% end %> + <%= render Admin::TableActionsComponent.new(tenant, actions: [:edit]) %> <% end %> diff --git a/spec/system/admin/tenants_spec.rb b/spec/system/admin/tenants_spec.rb index bbc0bbf76..92096261b 100644 --- a/spec/system/admin/tenants_spec.rb +++ b/spec/system/admin/tenants_spec.rb @@ -19,11 +19,7 @@ describe "Tenants", :admin, :seed_tenants do expect(page).to have_content "Tenant created successfully" - within("tr", text: "earth") do - expect(page).to have_content "earth.lvh.me" - - click_link "View" - end + click_link "earth.lvh.me" expect(current_host).to eq "http://earth.lvh.me" expect(page).to have_current_path root_path @@ -38,11 +34,7 @@ describe "Tenants", :admin, :seed_tenants do fill_in "Name", with: "Earthlings" click_button "Create tenant" - within("tr", text: "earth") do - expect(page).to have_content "earth.lvh.me" - - click_link "View" - end + click_link "earth.lvh.me" expect(current_host).to eq "http://earth.lvh.me" expect(page).to have_current_path root_path @@ -65,7 +57,7 @@ describe "Tenants", :admin, :seed_tenants do expect(page).to have_content "Tenant updated successfully" - within("tr", text: "the-moon") { click_link "View" } + click_link "the-moon.lvh.me" expect(current_host).to eq "http://the-moon.lvh.me" expect(page).to have_current_path root_path