59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
<h1>Listing Prompt requests</h1>
|
|
|
|
<%= if @live_action in [:new, :edit] do %>
|
|
<.modal return_to={Routes.prompt_request_index_path(@socket, :index)}>
|
|
<.live_component
|
|
module={DiffuserWeb.PromptRequestLive.FormComponent}
|
|
id={@prompt_request.id || :new}
|
|
title={@page_title}
|
|
action={@live_action}
|
|
prompt_request={@prompt_request}}
|
|
/>
|
|
</.modal>
|
|
<% end %>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Image</th>
|
|
<th>Prompt</th>
|
|
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="prompt_requests">
|
|
<%= for prompt_request <- @page.entries do %>
|
|
<tr id={"prompt_request-#{prompt_request.id}"}>
|
|
<td>
|
|
<%= for result <- prompt_request.images do %>
|
|
<img src={"#{Diffuser.Uploaders.Image.url({result.image, result})}"} />
|
|
<% end %>
|
|
</td>
|
|
<td><%= prompt_request.prompt %></td>
|
|
|
|
<td>
|
|
<span><%= live_redirect "Show", to: Routes.prompt_request_show_path(@socket, :show, prompt_request) %></span>
|
|
<span><%= live_patch "Edit", to: Routes.prompt_request_index_path(@socket, :edit, prompt_request) %></span>
|
|
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: prompt_request.id, data: [confirm: "Are you sure?"] %></span>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="pagination">
|
|
<%= if @page.page_number > 1 do %>
|
|
<%= live_patch "<< Prev Page",
|
|
to: Routes.prompt_request_index_path(@socket, :index, page: @page.page_number - 1),
|
|
class: "pagination-link" %>
|
|
<% end %>
|
|
|
|
<%= if @page.page_number < @page.total_pages do %>
|
|
<%= live_patch "Next Page >>",
|
|
to: Routes.prompt_request_index_path(@socket, :index, page: @page.page_number + 1),
|
|
class: "pagination-link" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<span><%= live_patch "New Prompt request", to: Routes.prompt_request_index_path(@socket, :new) %></span>
|