From 0039146cd456ac275a8c52c8fc116003c9c2cd22 Mon Sep 17 00:00:00 2001 From: Adam Piontek Date: Fri, 5 Mar 2021 15:32:01 -0500 Subject: [PATCH] changes to accommodate a delete user modal --- lib/bones73k/accounts/user.ex | 2 +- lib/bones73k/properties/property.ex | 2 +- lib/bones73k_web/live/modal_component.ex | 6 +- .../live/property_live/form_component.ex | 6 + .../property_live/form_component.html.leex | 70 +++++--- .../live/user_management/delete_component.ex | 44 +++++ .../delete_component.html.leex | 16 ++ .../live/user_management/form_component.ex | 8 +- .../user_management/form_component.html.leex | 113 ++++++------ .../live/user_management/index.ex | 73 ++++---- .../live/user_management/index.html.leex | 167 ++++++++++-------- .../20200914162043_create_properties.exs | 2 +- test/bones73k/accounts_test.exs | 2 +- 13 files changed, 302 insertions(+), 209 deletions(-) create mode 100644 lib/bones73k_web/live/user_management/delete_component.ex create mode 100644 lib/bones73k_web/live/user_management/delete_component.html.leex diff --git a/lib/bones73k/accounts/user.ex b/lib/bones73k/accounts/user.ex index 8d67ee0..63f9da3 100644 --- a/lib/bones73k/accounts/user.ex +++ b/lib/bones73k/accounts/user.ex @@ -17,7 +17,7 @@ defmodule Bones73k.Accounts.User do @derive {Inspect, except: [:password]} @primary_key {:id, :binary_id, autogenerate: true} - @foreign_key_type :binary_id + # @foreign_key_type :binary_id schema "users" do field :email, :string field :password, :string, virtual: true diff --git a/lib/bones73k/properties/property.ex b/lib/bones73k/properties/property.ex index 97135e1..7b5a688 100644 --- a/lib/bones73k/properties/property.ex +++ b/lib/bones73k/properties/property.ex @@ -8,7 +8,7 @@ defmodule Bones73k.Properties.Property do field :description, :string field :name, :string field :price, :decimal - belongs_to :user, Bones73k.Accounts.User + field :user_id, :binary_id timestamps() end diff --git a/lib/bones73k_web/live/modal_component.ex b/lib/bones73k_web/live/modal_component.ex index 63df8b8..8336359 100644 --- a/lib/bones73k_web/live/modal_component.ex +++ b/lib/bones73k_web/live/modal_component.ex @@ -11,7 +11,7 @@ defmodule Bones73kWeb.ModalComponent do phx-target="#<%= @id %>" phx-page-loading> -