summaryrefslogtreecommitdiff
path: root/lib/aggiedit_web/live/post_live/form_component.html.heex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/aggiedit_web/live/post_live/form_component.html.heex')
-rw-r--r--lib/aggiedit_web/live/post_live/form_component.html.heex15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/aggiedit_web/live/post_live/form_component.html.heex b/lib/aggiedit_web/live/post_live/form_component.html.heex
index 695a90a..2f0738e 100644
--- a/lib/aggiedit_web/live/post_live/form_component.html.heex
+++ b/lib/aggiedit_web/live/post_live/form_component.html.heex
@@ -17,12 +17,19 @@
<%= textarea f, :body %>
<%= error_tag f, :body %>
- <%= live_file_input @uploads.upload %>
-
- <%= for upload <- @uploads.upload.entries do %>
+ <%= 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 %>
<div class="row">
<div class="column">
- <%= live_img_preview upload, height: 80 %>
+ <img style="height:80px" src={Routes.static_path(@socket, "/uploads/#{@post.upload.file}")} />
</div>
</div>
<% end %>