Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flash #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-warning {
color: #8a6d3b;
Expand Down
1 change: 0 additions & 1 deletion lib/todo_web/live/item_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<td><%= item.description %></td>
<td><%= Item.pretty_status(item) %></td>
<td>
<span><%= live_redirect "Show", to: Routes.item_show_path(@socket, :show, item) %></span>
<span><%= live_patch "Edit", to: Routes.item_index_path(@socket, :edit, item) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: item.id, data: [confirm: "Are you sure?"] %></span>
</td>
Expand Down
24 changes: 0 additions & 24 deletions lib/todo_web/live/item_live/show.ex

This file was deleted.

31 changes: 0 additions & 31 deletions lib/todo_web/live/item_live/show.html.heex

This file was deleted.

3 changes: 0 additions & 3 deletions lib/todo_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion lib/todo_web/templates/layout/app.html.heex
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<main>
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<%= @inner_content %>
</main>





2 changes: 2 additions & 0 deletions lib/todo_web/templates/page/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
<%= render "sell_box.html", header: "Privacy-Focused", content: "We'll never sell your personal information." %>
</section>

<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %> </p>

</section>
33 changes: 0 additions & 33 deletions test/todo_web/live/item_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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&#39;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