polish(rover): drop redundant View action; location cell already links
This commit is contained in:
parent
d44351366a
commit
558980a191
2 changed files with 3 additions and 18 deletions
|
|
@ -277,15 +277,8 @@ defmodule MicrowavepropWeb.RoverLocationsLive do
|
||||||
assigns = %{record: record, owner?: owner?(scope, record)}
|
assigns = %{record: record, owner?: owner?(scope, record)}
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex gap-2">
|
<div :if={@owner?} class="flex gap-2">
|
||||||
<.link
|
|
||||||
navigate={~p"/rover-locations/#{@record.id}"}
|
|
||||||
class="btn btn-xs btn-ghost"
|
|
||||||
>
|
|
||||||
View
|
|
||||||
</.link>
|
|
||||||
<button
|
<button
|
||||||
:if={@owner?}
|
|
||||||
type="button"
|
type="button"
|
||||||
phx-click="edit"
|
phx-click="edit"
|
||||||
phx-value-id={@record.id}
|
phx-value-id={@record.id}
|
||||||
|
|
@ -294,7 +287,6 @@ defmodule MicrowavepropWeb.RoverLocationsLive do
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
:if={@owner?}
|
|
||||||
type="button"
|
type="button"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
phx-value-id={@record.id}
|
phx-value-id={@record.id}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ defmodule MicrowavepropWeb.RoverLocationsLiveTest do
|
||||||
assert html =~ ~s(value="EM12gm")
|
assert html =~ ~s(value="EM12gm")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "View link on each row navigates to the show page", %{conn: conn, user: user} do
|
test "the location cell links to the show page", %{conn: conn, user: user} do
|
||||||
{:ok, loc} =
|
{:ok, loc} =
|
||||||
Rover.create_location(user, %{
|
Rover.create_location(user, %{
|
||||||
lat: 32.5,
|
lat: 32.5,
|
||||||
|
|
@ -132,14 +132,7 @@ defmodule MicrowavepropWeb.RoverLocationsLiveTest do
|
||||||
|
|
||||||
{:ok, lv, _html} = live(conn, ~p"/rover-locations")
|
{:ok, lv, _html} = live(conn, ~p"/rover-locations")
|
||||||
|
|
||||||
assert {:ok, _show_lv, html} =
|
assert has_element?(lv, "a[href='/rover-locations/#{loc.id}']")
|
||||||
lv
|
|
||||||
|> element("a[href='/rover-locations/#{loc.id}']", "View")
|
|
||||||
|> render_click()
|
|
||||||
|> follow_redirect(conn, ~p"/rover-locations/#{loc.id}")
|
|
||||||
|
|
||||||
assert html =~ "rooftop spot"
|
|
||||||
assert html =~ "EM12gm"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "edit/delete buttons appear only on the owner's row", %{conn: conn, user: user} do
|
test "edit/delete buttons appear only on the owner's row", %{conn: conn, user: user} do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue