diff --git a/assets/css/app.css b/assets/css/app.css index 264a18a..6b29a04 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -13,8 +13,6 @@ } .alert-info { color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1; } .alert-warning { color: #8a6d3b; diff --git a/lib/todo_web/live/item_live/index.html.heex b/lib/todo_web/live/item_live/index.html.heex index 88b6878..49e1cad 100644 --- a/lib/todo_web/live/item_live/index.html.heex +++ b/lib/todo_web/live/item_live/index.html.heex @@ -28,7 +28,6 @@ <%= item.description %> <%= Item.pretty_status(item) %> - <%= live_redirect "Show", to: Routes.item_show_path(@socket, :show, item) %> <%= live_patch "Edit", to: Routes.item_index_path(@socket, :edit, item) %> <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: item.id, data: [confirm: "Are you sure?"] %> diff --git a/lib/todo_web/live/item_live/show.ex b/lib/todo_web/live/item_live/show.ex deleted file mode 100644 index b8eca1b..0000000 --- a/lib/todo_web/live/item_live/show.ex +++ /dev/null @@ -1,24 +0,0 @@ -defmodule TodoWeb.ItemLive.Show do - use TodoWeb, :live_view - - alias Todo.Notebook - alias Todo.Notebook.Item - - @impl true - def mount(_params, _session, socket) do - {:ok, socket} - end - - @impl true - def handle_params(%{"id" => id}, _, socket) do - user_id = socket.assigns.current_user.id - - {:noreply, - socket - |> assign(:page_title, page_title(socket.assigns.live_action)) - |> assign(:item, Notebook.get_item!(id, user_id))} - end - - defp page_title(:show), do: "Show Item" - defp page_title(:edit), do: "Edit Item" -end diff --git a/lib/todo_web/live/item_live/show.html.heex b/lib/todo_web/live/item_live/show.html.heex deleted file mode 100644 index 86ed33d..0000000 --- a/lib/todo_web/live/item_live/show.html.heex +++ /dev/null @@ -1,31 +0,0 @@ -

Show Item

- -<%= if @live_action in [:edit] do %> - <.modal return_to={Routes.item_show_path(@socket, :show, @item)}> - <.live_component - module={TodoWeb.ItemLive.FormComponent} - id={@item.id} - title={@page_title} - action={@live_action} - item={@item} - current_user={@current_user} - return_to={Routes.item_show_path(@socket, :show, @item)} - /> - -<% end %> - - - -<%= live_patch "Edit", to: Routes.item_show_path(@socket, :edit, @item), class: "button" %> | -<%= live_redirect "Back", to: Routes.item_index_path(@socket, :index) %> diff --git a/lib/todo_web/router.ex b/lib/todo_web/router.ex index b4ec2e6..3fc8fd0 100644 --- a/lib/todo_web/router.ex +++ b/lib/todo_web/router.ex @@ -78,9 +78,6 @@ defmodule TodoWeb.Router do live "/items", ItemLive.Index, :index live "/items/new", ItemLive.Index, :new live "/items/:id/edit", ItemLive.Index, :edit - - live "/items/:id", ItemLive.Show, :show - live "/items/:id/show/edit", ItemLive.Show, :edit end end diff --git a/lib/todo_web/templates/layout/app.html.heex b/lib/todo_web/templates/layout/app.html.heex index 407d0aa..949a794 100644 --- a/lib/todo_web/templates/layout/app.html.heex +++ b/lib/todo_web/templates/layout/app.html.heex @@ -1,5 +1,9 @@
- <%= @inner_content %>
+ + + + + diff --git a/lib/todo_web/templates/page/index.html.heex b/lib/todo_web/templates/page/index.html.heex index 3753e5d..a6eb743 100644 --- a/lib/todo_web/templates/page/index.html.heex +++ b/lib/todo_web/templates/page/index.html.heex @@ -12,4 +12,6 @@ <%= render "sell_box.html", header: "Privacy-Focused", content: "We'll never sell your personal information." %> + + diff --git a/test/todo_web/live/item_live_test.exs b/test/todo_web/live/item_live_test.exs index e266699..ada098e 100644 --- a/test/todo_web/live/item_live_test.exs +++ b/test/todo_web/live/item_live_test.exs @@ -78,37 +78,4 @@ defmodule TodoWeb.ItemLiveTest do refute has_element?(index_live, "#item-#{item.id}") end end - - describe "Show" do - setup [:create_item] - - test "displays item", %{conn: conn, item: item} do - {:ok, _show_live, html} = live(conn, Routes.item_show_path(conn, :show, item)) - - assert html =~ "Show Item" - assert html =~ item.description - end - - test "updates item within modal", %{conn: conn, item: item} do - {:ok, show_live, _html} = live(conn, Routes.item_show_path(conn, :show, item)) - - assert show_live |> element("a", "Edit") |> render_click() =~ - "Edit Item" - - assert_patch(show_live, Routes.item_show_path(conn, :edit, item)) - - assert show_live - |> form("#item-form", item: @invalid_attrs) - |> render_change() =~ "can't be blank" - - {:ok, _, html} = - show_live - |> form("#item-form", item: @update_attrs) - |> render_submit() - |> follow_redirect(conn, Routes.item_show_path(conn, :show, item)) - - assert html =~ "Item updated successfully" - assert html =~ "some updated description" - end - end end