initial book review schema
This commit is contained in:
parent
e218290e08
commit
90414e6b93
15 changed files with 653 additions and 0 deletions
45
lib/wild_web/live/book_read_live/index.html.heex
Normal file
45
lib/wild_web/live/book_read_live/index.html.heex
Normal file
|
@ -0,0 +1,45 @@
|
|||
<.header>
|
||||
Listing Book reads
|
||||
<:actions>
|
||||
<.link patch={~p"/book_reads/new"}>
|
||||
<.button>New Book read</.button>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
<.table
|
||||
id="book_reads"
|
||||
rows={@streams.book_reads}
|
||||
row_click={fn {_id, book_read} -> JS.navigate(~p"/book_reads/#{book_read}") end}
|
||||
>
|
||||
<:col :let={{_id, book_read}} label="Rating">{book_read.rating}</:col>
|
||||
<:col :let={{_id, book_read}} label="Thoughts">{book_read.thoughts}</:col>
|
||||
<:col :let={{_id, book_read}} label="Read start">{book_read.read_start}</:col>
|
||||
<:col :let={{_id, book_read}} label="Read finish">{book_read.read_finish}</:col>
|
||||
<:col :let={{_id, book_read}} label="Progress">{book_read.progress}</:col>
|
||||
<:action :let={{_id, book_read}}>
|
||||
<div class="sr-only">
|
||||
<.link navigate={~p"/book_reads/#{book_read}"}>Show</.link>
|
||||
</div>
|
||||
<.link patch={~p"/book_reads/#{book_read}/edit"}>Edit</.link>
|
||||
</:action>
|
||||
<:action :let={{id, book_read}}>
|
||||
<.link
|
||||
phx-click={JS.push("delete", value: %{id: book_read.id}) |> hide("##{id}")}
|
||||
data-confirm="Are you sure?"
|
||||
>
|
||||
Delete
|
||||
</.link>
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
<.modal :if={@live_action in [:new, :edit]} id="book_read-modal" show on_cancel={JS.patch(~p"/book_reads")}>
|
||||
<.live_component
|
||||
module={WildWeb.BookReadLive.FormComponent}
|
||||
id={@book_read.id || :new}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
book_read={@book_read}
|
||||
patch={~p"/book_reads"}
|
||||
/>
|
||||
</.modal>
|
Loading…
Add table
Add a link
Reference in a new issue