From 903adf59b05c49cafe137decbf37609d9aa11265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Rodrigues?= Date: Mon, 1 Jul 2024 14:16:31 +0100 Subject: [PATCH] chore: implement suggestions --- lib/atomic/partnerships.ex | 2 +- lib/atomic_web/live/partner_live/edit.html.heex | 2 +- lib/atomic_web/live/partner_live/form_component.ex | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/atomic/partnerships.ex b/lib/atomic/partnerships.ex index 82c579f96..ffd280f9d 100644 --- a/lib/atomic/partnerships.ex +++ b/lib/atomic/partnerships.ex @@ -86,7 +86,7 @@ defmodule Atomic.Partners do |> after_save(after_save) end - def update_partner_banner(%Partner{} = partner, attrs, _after_save \\ &{:ok, &1}) do + def update_partner_picture(%Partner{} = partner, attrs, _after_save \\ &{:ok, &1}) do partner |> Partner.image_changeset(attrs) |> Repo.update() diff --git a/lib/atomic_web/live/partner_live/edit.html.heex b/lib/atomic_web/live/partner_live/edit.html.heex index c2adab77a..0f8a76911 100644 --- a/lib/atomic_web/live/partner_live/edit.html.heex +++ b/lib/atomic_web/live/partner_live/edit.html.heex @@ -27,7 +27,7 @@ <% end %>
- <.live_component module={AtomicWeb.PartnerLive.FormComponent} current_user={@current_user} id={@partner.id || :new} title={@page_title} action={@live_action} partner={@partner} return_to={Routes.partner_index_path(@socket, :index, @current_organization)} /> + <.live_component module={AtomicWeb.PartnerLive.FormComponent} organization={@current_organization} id={@partner.id || :new} title={@page_title} action={@live_action} partner={@partner} return_to={Routes.partner_index_path(@socket, :index, @current_organization)} />
diff --git a/lib/atomic_web/live/partner_live/form_component.ex b/lib/atomic_web/live/partner_live/form_component.ex index 9ea984b77..ff971e61b 100644 --- a/lib/atomic_web/live/partner_live/form_component.ex +++ b/lib/atomic_web/live/partner_live/form_component.ex @@ -17,7 +17,7 @@ defmodule AtomicWeb.PartnerLive.FormComponent do <.field type="text" help_text={gettext("A brief description of the partner")} field={f[:description]} placeholder="Description" required /> <.field type="textarea" help_text={gettext("Benefits of the partnership")} field={f[:benefits]} placeholder="Benefits" required /> <.inputs_for :let={location_form} field={f[:location]}> - <.field field={location_form[:name]} type="text" placeholder="Location name" help_text={gettext("The name of the location")} required /> + <.field field={location_form[:name]} label="Address" type="text" placeholder="Address" help_text={gettext("Address of the partner")} required />

<%= gettext("Socials") %>

@@ -99,7 +99,7 @@ defmodule AtomicWeb.PartnerLive.FormComponent do end defp save_partner(socket, :new, partner_params) do - organization_id = socket.assigns.current_user.current_organization_id + organization_id = socket.assigns.organization.id partner_params = Map.put(partner_params, "organization_id", organization_id) case Partners.create_partner(partner_params, &consume_image_data(socket, &1)) do @@ -116,7 +116,7 @@ defmodule AtomicWeb.PartnerLive.FormComponent do defp consume_image_data(socket, partner) do consume_uploaded_entries(socket, :image, fn %{path: path}, entry -> - Partners.update_partner_banner(partner, %{ + Partners.update_partner_picture(partner, %{ "image" => %Plug.Upload{ content_type: entry.client_type, filename: entry.client_name,