Aggiedit/lib/aggiedit_web/live/post_live/form_component.html.heex

42 lines
1020 B
Plaintext
Raw Normal View History

<div>
<h2><%= @title %></h2>
<.form
let={f}
for={@changeset}
id="post-form"
phx-target={@myself}
phx-change="validate"
phx-submit="save">
2022-04-14 02:18:01 -04:00
<div class="form-group">
<%= label f, :title %>
<%= text_input f, :title, class: "form-control" %>
<%= error_tag f, :title %>
</div>
2022-04-14 02:18:01 -04:00
<div class="form-group mt-2">
<%= label f, :body %>
<%= textarea f, :body, class: "form-control" %>
<%= error_tag f, :body %>
</div>
2022-04-14 02:18:01 -04:00
<div class="form-group mt-2">
<%= 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>
2022-04-08 15:01:24 -04:00
</div>
2022-04-14 02:18:01 -04:00
<% end %>
2022-04-08 15:01:24 -04:00
<% end %>
2022-04-14 02:18:01 -04:00
</div>
2022-04-14 02:18:01 -04:00
<div class="mt-2">
<%= submit "Save", phx_disable_with: "Saving...", class: "btn btn-primary" %>
</div>
</.form>
</div>