<%= @title %>
<.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 %>
<%= if !Ecto.assoc_loaded?(@post.upload) do %>
<%= live_file_input @uploads.upload %>
<%= for upload <- @uploads.upload.entries do %>
<%= live_img_preview upload, height: 80 %>
<% end %>
<%= else %>
<% if !is_nil(@post.upload) do %>
<% end %>
<% end %>
<%= submit "Save", phx_disable_with: "Saving..." %>