memEx/lib/memex_web/live/note_live/index.html.heex

67 lines
1.6 KiB
Plaintext
Raw Normal View History

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>
2022-11-16 21:11:02 -05:00
<.link navigate={Routes.note_show_path(@socket, :show, note)}>
<%= dgettext("actions", "Show") %>
</.link>
2022-07-25 22:05:54 -04:00
</span>
<span>
2022-11-16 21:11:02 -05:00
<.link patch={Routes.note_index_path(@socket, :edit, note)}>
<%= dgettext("actions", "Edit") %>
</.link>
</span>
<span>
<.link
href="#"
phx-click="delete"
phx-value-id={note.id}
data-confirm={dgettext("prompts", "Are you sure?")}
>
<%= dgettext("actions", "Delete") %>
</.link>
2022-07-25 22:05:54 -04:00
</span>
2022-07-25 20:08:40 -04:00
</td>
</tr>
<% end %>
</tbody>
</table>
2022-11-16 21:11:02 -05:00
<span>
<.link patch={Routes.note_index_path(@socket, :new)}>
<%= dgettext("actions", "New Note") %>
</.link>
</span>