Skip to content

Commit

Permalink
chore: implement suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRodrigues10 committed Jul 1, 2024
1 parent 1ff218f commit 903adf5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/atomic/partnerships.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/atomic_web/live/partner_live/edit.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<% end %>
</:actions>
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
<.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)} />
</div>
</.page>

Expand Down
6 changes: 3 additions & 3 deletions lib/atomic_web/live/partner_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
</.inputs_for>
<h2 class="mt-8 mb-2 w-full border-b pb-2 text-lg font-semibold text-gray-900"><%= gettext("Socials") %></h2>
<div class="grid w-full gap-x-4 sm:grid-cols-1 md:grid-cols-4 lg:grid-cols-4">
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 903adf5

Please sign in to comment.