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

67 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-11-17 22:30:01 -05:00
<h1>listing contexts</h1>
2022-07-25 20:11:08 -04:00
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.context_index_path(@socket, :index)}>
<.live_component
module={MemexWeb.ContextLive.FormComponent}
id={@context.id || :new}
title={@page_title}
action={@live_action}
context={@context}
return_to={Routes.context_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="contexts">
<%= for context <- @contexts do %>
<tr id={"context-#{context.id}"}>
<td><%= context.title %></td>
<td><%= context.content %></td>
<td><%= context.tag %></td>
<td><%= context.visibility %></td>
<td>
2022-07-25 22:05:54 -04:00
<span>
2022-11-16 21:11:02 -05:00
<.link navigate={Routes.context_show_path(@socket, :show, context)}>
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "show") %>
2022-11-16 21:11:02 -05:00
</.link>
2022-07-25 22:05:54 -04:00
</span>
<span>
2022-11-16 21:11:02 -05:00
<.link patch={Routes.context_index_path(@socket, :edit, context)}>
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "edit") %>
2022-11-16 21:11:02 -05:00
</.link>
2022-07-25 22:05:54 -04:00
</span>
<span>
2022-11-16 21:11:02 -05:00
<.link
href="#"
phx-click="delete"
phx-value-id={context.id}
2022-11-17 22:30:01 -05:00
data-confirm={dgettext("prompts", "are you sure?")}
2022-11-16 21:11:02 -05:00
>
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "delete") %>
2022-11-16 21:11:02 -05:00
</.link>
2022-07-25 22:05:54 -04:00
</span>
2022-07-25 20:11:08 -04:00
</td>
</tr>
<% end %>
</tbody>
</table>
2022-11-16 21:11:02 -05:00
<span>
<.link patch={Routes.context_index_path(@socket, :new)}>
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "new context") %>
2022-11-16 21:11:02 -05:00
</.link>
</span>