foci show/index cleanups

345baf0 · gmorell · 2022-07-30 18:09

10 files +37 -32

Files changed

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/index.ex
+3 −3
@@ -16,19 +16,19 @@ defmodule RoomSanctumWeb.FociLive.Index do
16 16
17 17 defp apply_action(socket, :edit, %{"id" => id}) do
18 18 socket
19 − |> assign(:page_title, "Edit Foci")
19 + |> assign(:page_title, "Modify Foci")
20 20 |> assign(:foci, Configuration.get_foci!(id))
21 21 end
22 22
23 23 defp apply_action(socket, :new, _params) do
24 24 socket
25 − |> assign(:page_title, "New Foci")
25 + |> assign(:page_title, "Register Foci")
26 26 |> assign(:foci, %Foci{})
27 27 end
28 28
29 29 defp apply_action(socket, :index, _params) do
30 30 socket
31 − |> assign(:page_title, "Listing Focis")
31 + |> assign(:page_title, "Available Foci")
32 32 |> assign(:foci, nil)
33 33 end
34 34
modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/index.html.heex
+14 −9
@@ -1,4 +1,5 @@
1 −<h1>Listing Focis</h1>
1 +<.itb icon="fa-plus" to={Routes.foci_index_path(@socket, :new)} what="Foci"></.itb>
2 +<h1 class="text-3xl font-bold text-accent mx-4 bg-secondary-300 py-2">Available Foci</h1>
2 3
3 4 <%= if @live_action in [:new, :edit] do %>
4 5 <.modal return_to={Routes.foci_index_path(@socket, :index)}>
@@ -14,11 +15,10 @@
14 15 </.modal>
15 16 <% end %>
16 17
17 −<table>
18 +<table class="table table-compact w-full mx-6">
18 19 <thead>
19 20 <tr>
20 21 <th>Name</th>
21 − <th>Place</th>
22 22
23 23 <th></th>
24 24 </tr>
@@ -27,16 +27,21 @@
27 27 <%= for foci <- @focis do %>
28 28 <tr id={"foci-#{foci.id}"}>
29 29 <td><%= foci.name %></td>
30 − <td>$place</td>
31 30
32 31 <td>
33 − <span><%= live_redirect "Show", to: Routes.foci_show_path(@socket, :show, foci) %></span>
34 − <span><%= live_patch "Edit", to: Routes.foci_index_path(@socket, :edit, foci) %></span>
35 − <span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: foci.id, data: [confirm: "Are you sure?"] %></span>
32 + <span>
33 + <.ib icon="fa-eye" to={Routes.foci_show_path(@socket, :show, foci)} function={:live_redirect}></.ib>
34 + </span>
35 + <span>
36 + <.ib icon="fa-pencil" to={Routes.foci_index_path(@socket, :edit, foci)}></.ib>
37 + </span>
38 + <span>
39 + <%= link to: "#", phx_click: "delete", phx_value_id: foci.id, data: [confirm: "Are you sure?"], class: "btn btn-square btn-xs" do %>
40 + <i class="fa-solid fa-trash"></i>
41 + <% end %>
42 + </span>
36 43 </td>
37 44 </tr>
38 45 <% end %>
39 46 </tbody>
40 47 </table>
41 −
42 −<span><%= live_patch "New Foci", to: Routes.foci_index_path(@socket, :new) %></span>
modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/show.ex
+2 −2
@@ -16,6 +16,6 @@ defmodule RoomSanctumWeb.FociLive.Show do
16 16 |> assign(:foci, Configuration.get_foci!(id))}
17 17 end
18 18
19 − defp page_title(:show), do: "Show Foci"
20 − defp page_title(:edit), do: "Edit Foci"
19 + defp page_title(:show), do: "Foci Detail"
20 + defp page_title(:edit), do: "Modify Foci"
21 21 end
modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/show.html.heex
+18 −18
@@ -1,4 +1,7 @@
1 −<h1>Show Foci</h1>
1 +<.itb icon="fa-chevron-left" to={Routes.foci_index_path(@socket, :index)} what="Back"></.itb>
2 +<.itb icon="fa-pencil" to={Routes.foci_show_path(@socket, :edit, @foci)} what="Edit"></.itb>
3 +
4 +<h1 class="text-3xl font-bold text-accent mx-4 py-2">Foci Detail</h1>
2 5
3 6 <%= if @live_action in [:edit] do %>
4 7 <.modal return_to={Routes.foci_show_path(@socket, :show, @foci)}>
@@ -12,20 +15,17 @@
12 15 />
13 16 </.modal>
14 17 <% end %>
15 −
16 −<ul>
17 −
18 − <li>
19 − <strong>Name:</strong>
20 − <%= @foci.name %>
21 − </li>
22 −
23 − <li>
24 − <strong>Place:</strong>
25 − <%= @foci.place %>
26 − </li>
27 −
28 −</ul>
29 −
30 −<span><%= live_patch "Edit", to: Routes.foci_show_path(@socket, :edit, @foci), class: "button" %></span> |
31 −<span><%= live_redirect "Back", to: Routes.foci_index_path(@socket, :index) %></span>
18 +<div class="mx-4 py-2">
19 + <div class="flex">
20 + <h2 class="text-2xl font-bold text-accent-300"><%= @foci.name %>
21 + </h2>
22 + </div>
23 + <div class="flex">
24 + <div class="card card-compact w-3/4 bg-base-100 shadow-xl m-2">
25 + <div class="card-body">
26 + <h3 class="card-title">Place</h3>
27 + <pre>@foci.place</pre>
28 + </div>
29 + </div>
30 + </div>
31 +</div>

Parents: 0e04bfa