From f6b262ea668bfaef48be40efb809e791258e2417 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Thu, 21 Apr 2022 17:23:17 -0600 Subject: Updates to frontend and fix a bug where first socket assignment failed --- lib/aggiedit_web/live/post_live/form_component.ex | 4 +- lib/aggiedit_web/live/post_live/show.html.heex | 70 ++++------------------- 2 files changed, 15 insertions(+), 59 deletions(-) (limited to 'lib/aggiedit_web/live') diff --git a/lib/aggiedit_web/live/post_live/form_component.ex b/lib/aggiedit_web/live/post_live/form_component.ex index 8714277..43e6b9b 100644 --- a/lib/aggiedit_web/live/post_live/form_component.ex +++ b/lib/aggiedit_web/live/post_live/form_component.ex @@ -39,7 +39,9 @@ defmodule AggieditWeb.PostLive.FormComponent do filename = "#{upload.uuid}.#{extension}" dest = Path.join("priv/static/uploads", filename) - File.cp!(data.path, dest) + with :ok <- File.mkdir_p(Path.dirname(dest)) do + File.cp!(data.path, dest) + end {:ok, upload} = Uploads.create_upload(%{ file: filename, diff --git a/lib/aggiedit_web/live/post_live/show.html.heex b/lib/aggiedit_web/live/post_live/show.html.heex index b89999b..f0d1f41 100644 --- a/lib/aggiedit_web/live/post_live/show.html.heex +++ b/lib/aggiedit_web/live/post_live/show.html.heex @@ -1,4 +1,3 @@ -
@@ -6,7 +5,7 @@
<%= if Ecto.assoc_loaded?(@post.upload) && !is_nil(@post.upload) do %> - + <% end %>
@@ -16,21 +15,18 @@ <%= live_patch "Edit", to: Routes.post_show_path(@socket, :edit, @room, @post), class: "button" %> | <% end %> <%= live_redirect "Back", to: Routes.post_index_path(@socket, :index, @room) %> -
-
- -
-
-
-
-
Chat
-
-
    -
-
-
-
+
+
+
+
+
+
+ + +
+ +
@@ -47,45 +43,3 @@ /> <% end %> - - -- cgit v1.2.3-70-g09d2