From fdb3ba3c95306fa3358ae9885fe1e1dfdff94d18 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Thu, 24 Oct 2024 09:45:42 -0400 Subject: [PATCH] Media - display file name Useful to copy and paste into the Visual Editor, on the .image component --- .../live/media_library_live/show_component.ex | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/beacon/live_admin/live/media_library_live/show_component.ex b/lib/beacon/live_admin/live/media_library_live/show_component.ex index f1e0ebab..5859d877 100644 --- a/lib/beacon/live_admin/live/media_library_live/show_component.ex +++ b/lib/beacon/live_admin/live/media_library_live/show_component.ex @@ -13,16 +13,18 @@ defmodule Beacon.LiveAdmin.MediaLibraryLive.ShowComponent do socket |> assign(assigns) |> assign(:is_image?, MediaLibrary.is_image?(site, asset)) - |> assign(:url, MediaLibrary.url_for(site, asset)) |> assign(:urls, urls_for(site, asset)) {:ok, socket} end defp urls_for(site, asset) do - site - |> MediaLibrary.urls_for(asset) - |> Enum.with_index() + urls = + site + |> MediaLibrary.urls_for(asset) + |> Enum.with_index(1) + + [{{"name", asset.file_name}, 0} | urls] end @impl true @@ -38,7 +40,7 @@ defmodule Beacon.LiveAdmin.MediaLibraryLive.ShowComponent do - +