From cc4679c9ab0bc2607179a26556e3b381a7a2533c Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Fri, 8 Apr 2022 13:01:24 -0600 Subject: Don't allow upload editing for posts --- lib/aggiedit_web/live/post_live/form_component.html.heex | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/aggiedit_web/live/post_live/form_component.html.heex') 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 %> +
+
+ <%= live_img_preview upload, height: 80 %> +
+
+ <% end %> + <%= else %>
- <%= live_img_preview upload, height: 80 %> +
<% end %> -- cgit v1.2.3-70-g09d2