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.
This commit is contained in:
Javi Martín
2022-12-13 16:26:27 +01:00
parent 09b9d2b88e
commit 7bcdb6a9db
2 changed files with 5 additions and 15 deletions

View File

@@ -17,11 +17,9 @@
<tr id="<%= dom_id(tenant) %>"> <tr id="<%= dom_id(tenant) %>">
<td><%= tenant.name %></td> <td><%= tenant.name %></td>
<td><%= tenant.schema %></td> <td><%= tenant.schema %></td>
<td><%= tenant.host %></td> <td><%= link_to tenant.host, root_url(host: tenant.host) %></td>
<td> <td>
<%= render Admin::TableActionsComponent.new(tenant, actions: [:edit]) do |actions| %> <%= render Admin::TableActionsComponent.new(tenant, actions: [:edit]) %>
<%= actions.action(:show, text: t("admin.shared.view"), path: root_url(host: tenant.host)) %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -19,11 +19,7 @@ describe "Tenants", :admin, :seed_tenants do
expect(page).to have_content "Tenant created successfully" expect(page).to have_content "Tenant created successfully"
within("tr", text: "earth") do click_link "earth.lvh.me"
expect(page).to have_content "earth.lvh.me"
click_link "View"
end
expect(current_host).to eq "http://earth.lvh.me" expect(current_host).to eq "http://earth.lvh.me"
expect(page).to have_current_path root_path expect(page).to have_current_path root_path
@@ -38,11 +34,7 @@ describe "Tenants", :admin, :seed_tenants do
fill_in "Name", with: "Earthlings" fill_in "Name", with: "Earthlings"
click_button "Create tenant" click_button "Create tenant"
within("tr", text: "earth") do click_link "earth.lvh.me"
expect(page).to have_content "earth.lvh.me"
click_link "View"
end
expect(current_host).to eq "http://earth.lvh.me" expect(current_host).to eq "http://earth.lvh.me"
expect(page).to have_current_path root_path 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" 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(current_host).to eq "http://the-moon.lvh.me"
expect(page).to have_current_path root_path expect(page).to have_current_path root_path