2022-04-06 14:55:12 -04:00
|
|
|
<div>
|
|
|
|
<h2><%= @title %></h2>
|
|
|
|
|
|
|
|
<.form
|
|
|
|
let={f}
|
|
|
|
for={@changeset}
|
|
|
|
id="post-form"
|
|
|
|
phx-target={@myself}
|
|
|
|
phx-change="validate"
|
|
|
|
phx-submit="save">
|
|
|
|
|
|
|
|
<%= label f, :title %>
|
|
|
|
<%= textarea f, :title %>
|
|
|
|
<%= error_tag f, :title %>
|
|
|
|
|
|
|
|
<%= label f, :body %>
|
|
|
|
<%= textarea f, :body %>
|
|
|
|
<%= error_tag f, :body %>
|
2022-04-06 20:17:27 -04:00
|
|
|
|
2022-04-08 15:01:24 -04:00
|
|
|
<%= if !Ecto.assoc_loaded?(@post.upload) do %>
|
|
|
|
<%= live_file_input @uploads.upload %>
|
|
|
|
<%= for upload <- @uploads.upload.entries do %>
|
|
|
|
<div class="row">
|
|
|
|
<div class="column">
|
|
|
|
<%= live_img_preview upload, height: 80 %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<%= else %>
|
2022-04-08 15:04:08 -04:00
|
|
|
<% if !is_nil(@post.upload) do %>
|
|
|
|
<div class="row">
|
|
|
|
<div class="column">
|
|
|
|
<img style="height:80px" src={Routes.static_path(@socket, "/uploads/#{@post.upload.file}")} />
|
|
|
|
</div>
|
2022-04-06 20:17:27 -04:00
|
|
|
</div>
|
2022-04-08 15:04:08 -04:00
|
|
|
<% end %>
|
2022-04-06 20:17:27 -04:00
|
|
|
<% end %>
|
2022-04-06 14:55:12 -04:00
|
|
|
|
|
|
|
<div>
|
|
|
|
<%= submit "Save", phx_disable_with: "Saving..." %>
|
|
|
|
</div>
|
|
|
|
</.form>
|
|
|
|
</div>
|