2022-07-25 20:08:40 -04:00
|
|
|
<h1>Listing Notes</h1>
|
|
|
|
|
|
|
|
<%= if @live_action in [:new, :edit] do %>
|
|
|
|
<.modal return_to={Routes.note_index_path(@socket, :index)}>
|
|
|
|
<.live_component
|
|
|
|
module={MemexWeb.NoteLive.FormComponent}
|
|
|
|
id={@note.id || :new}
|
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
note={@note}
|
|
|
|
return_to={Routes.note_index_path(@socket, :index)}
|
|
|
|
/>
|
|
|
|
</.modal>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Title</th>
|
|
|
|
<th>Content</th>
|
|
|
|
<th>Tag</th>
|
|
|
|
<th>Visibility</th>
|
|
|
|
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="notes">
|
|
|
|
<%= for note <- @notes do %>
|
|
|
|
<tr id={"note-#{note.id}"}>
|
|
|
|
<td><%= note.title %></td>
|
|
|
|
<td><%= note.content %></td>
|
|
|
|
<td><%= note.tag %></td>
|
|
|
|
<td><%= note.visibility %></td>
|
|
|
|
|
|
|
|
<td>
|
2022-07-25 22:05:54 -04:00
|
|
|
<span>
|
|
|
|
<%= live_redirect("Show", to: Routes.note_show_path(@socket, :show, note)) %>
|
|
|
|
</span>
|
|
|
|
<span><%= live_patch("Edit", to: Routes.note_index_path(@socket, :edit, note)) %></span>
|
|
|
|
<span>
|
|
|
|
<%= link("Delete",
|
|
|
|
to: "#",
|
|
|
|
phx_click: "delete",
|
|
|
|
phx_value_id: note.id,
|
|
|
|
data: [confirm: "Are you sure?"]
|
|
|
|
) %>
|
|
|
|
</span>
|
2022-07-25 20:08:40 -04:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2022-07-25 22:05:54 -04:00
|
|
|
<span><%= live_patch("New Note", to: Routes.note_index_path(@socket, :new)) %></span>
|