Packages

phoenix_kit

1.7.157
1.7.207 1.7.206 1.7.205 1.7.204 1.7.203 1.7.202 1.7.201 1.7.200 1.7.199 1.7.198 1.7.197 1.7.196 1.7.194 1.7.193 1.7.192 1.7.191 1.7.190 1.7.189 1.7.187 1.7.186 1.7.185 1.7.184 1.7.183 1.7.182 1.7.181 1.7.180 1.7.179 1.7.178 1.7.177 1.7.176 1.7.175 1.7.174 1.7.173 1.7.172 1.7.171 1.7.170 1.7.169 1.7.168 1.7.167 1.7.166 1.7.165 1.7.164 1.7.162 1.7.161 1.7.160 1.7.159 1.7.157 1.7.156 1.7.155 1.7.154 1.7.153 1.7.152 1.7.151 1.7.150 1.7.149 1.7.146 1.7.145 1.7.144 1.7.143 1.7.138 1.7.133 1.7.132 1.7.131 1.7.130 1.7.128 1.7.126 1.7.125 1.7.121 1.7.120 1.7.119 1.7.118 1.7.117 1.7.116 1.7.115 1.7.114 1.7.113 1.7.112 1.7.111 1.7.110 1.7.109 1.7.108 1.7.107 1.7.106 1.7.105 1.7.104 1.7.103 1.7.102 1.7.101 1.7.100 1.7.99 1.7.98 1.7.97 1.7.96 1.7.95 1.7.94 1.7.93 1.7.92 1.7.91 1.7.90 1.7.89 1.7.88 1.7.87 1.7.86 1.7.85 1.7.84 1.7.83 1.7.82 1.7.81 1.7.80 1.7.79 1.7.78 1.7.77 1.7.76 1.7.75 1.7.74 1.7.71 1.7.70 1.7.69 1.7.66 1.7.65 1.7.64 1.7.63 1.7.62 1.7.61 1.7.59 1.7.58 1.7.57 1.7.56 1.7.55 1.7.54 1.7.53 1.7.52 1.7.51 1.7.49 1.7.44 1.7.43 1.7.42 1.7.41 1.7.39 1.7.38 1.7.37 1.7.36 1.7.34 1.7.33 1.7.31 1.7.30 1.7.29 1.7.28 1.7.27 1.7.26 1.7.25 1.7.24 1.7.23 1.7.22 1.7.21 1.7.20 1.7.19 1.7.18 1.7.17 1.7.16 1.7.15 1.7.14 1.7.13 1.7.12 1.7.11 1.7.10 1.7.9 1.7.8 1.7.7 1.7.6 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1 1.7.0 1.6.20 1.6.19 1.6.18 1.6.17 1.6.16 1.6.15 1.6.14 1.6.13 1.6.12 1.6.11 1.6.10 1.6.9 1.6.8 1.6.7 1.6.6 1.6.5 1.6.4 1.6.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.10 1.2.9 1.2.8 1.2.7 1.2.5 1.2.4 1.2.2 1.2.1 1.2.0 1.1.0 1.0.0

A foundation for building Elixir Phoenix apps — SaaS, social networks, ERP systems, marketplaces, and more

Current section

221 Versions

Jump to

Compare versions

11 files changed
+75 additions
-13 deletions
unknownCHANGELOG.md
File is too large to be displayed (100 KB limit).
  @@ -1,6 +1,6 @@
1 1 {<<"links">>,[{<<"GitHub">>,<<"https://github.com/BeamLabEU/phoenix_kit">>}]}.
2 2 {<<"name">>,<<"phoenix_kit">>}.
3 - {<<"version">>,<<"1.7.156">>}.
3 + {<<"version">>,<<"1.7.157">>}.
4 4 {<<"description">>,
5 5 <<65,32,102,111,117,110,100,97,116,105,111,110,32,102,111,114,32,98,117,105,
6 6 108,100,105,110,103,32,69,108,105,120,105,114,32,80,104,111,101,110,105,
  @@ -21,7 +21,9 @@ defmodule PhoenixKit.Annotations do
21 21 alias PhoenixKit.Annotations.Annotation
22 22 alias PhoenixKit.Modules.Storage
23 23 alias PhoenixKit.Modules.Storage.File, as: StorageFile
24 + alias PhoenixKit.Modules.Storage.URLSigner
24 25 alias PhoenixKit.RepoHelper
26 + alias PhoenixKit.Utils.Routes
25 27
26 28 @type attrs :: map()
27 29 @type uuid :: String.t()
  @@ -49,6 +51,44 @@ defmodule PhoenixKit.Annotations do
49 51
50 52 def has_annotations?(_), do: false
51 53
54 + @doc """
55 + Resolves `"file"` comment resources for the comments moderation admin.
56 +
57 + Comments on files — including annotation discussions, which are anchored to
58 + the file with `metadata.annotation_uuid` — carry `resource_type: "file"` and
59 + `resource_uuid: file_uuid`. This maps those file uuids to the file's display
60 + name and admin media path so the moderation list links to the file instead
61 + of showing a bare uuid.
62 +
63 + Registered as the `"file"` handler by `phoenix_kit_comments`'
64 + `resolve_comment_resources/1` dispatch (gated on this module being loaded).
65 + """
66 + @spec resolve_comment_resources([uuid()]) :: %{uuid() => map()}
67 + def resolve_comment_resources(resource_uuids) when is_list(resource_uuids) do
68 + from(f in StorageFile,
69 + where: f.uuid in ^resource_uuids,
70 + select: {f.uuid, f.original_file_name, f.file_name, f.file_type}
71 + )
72 + |> RepoHelper.all()
73 + |> Map.new(fn {uuid, original_name, file_name, file_type} ->
74 + info = %{
75 + title: original_name || file_name || "File",
76 + path: Routes.path("/admin/media/#{uuid}")
77 + }
78 +
79 + # A small signed thumbnail for image files, so the comments admin can show
80 + # a preview chip. Falls back to no thumb for non-images (or missing variants).
81 + info =
82 + if file_type == "image",
83 + do: Map.put(info, :thumb_url, URLSigner.signed_url(to_string(uuid), "thumbnail")),
84 + else: info
85 +
86 + {uuid, info}
87 + end)
88 + rescue
89 + _ -> %{}
90 + end
91 +
52 92 @doc "List annotations for a file, ordered by `position` then insertion time."
53 93 @spec list_for_file(uuid()) :: [Annotation.t()]
54 94 def list_for_file(file_uuid) do
  @@ -119,13 +119,9 @@ defmodule PhoenixKitWeb.Components.FolderExplorer do
119 119 style="width: 240px; max-width: 240px;"
120 120 >
121 121 <div class="flex items-center justify-between mb-3">
122 - <%= if is_nil(@scope_folder_id) do %>
123 - <h3 class="font-semibold text-sm text-base-content/70 uppercase tracking-wider">
124 - {gettext("Folders")}
125 - </h3>
126 - <% else %>
127 - <div></div>
128 - <% end %>
122 + <h3 class="font-semibold text-sm text-base-content/70 uppercase tracking-wider">
123 + {gettext("Folders")}
124 + </h3>
129 125 <div class="flex gap-0.5">
130 126 <button
131 127 :if={@show_create}
  @@ -331,13 +331,22 @@ defmodule PhoenixKitWeb.Components.LayoutWrapper do
331 331 >
332 332 {@project_title}
333 333 </.link>
334 - <span class="font-bold text-base-content shrink-0">{gettext("Admin Panel")}</span>
334 + <%!-- On mobile, when a page has a title, hide the "Admin
335 + Panel /" prefix and show just the page titlethe full
336 + breadcrumb is too wide and overlaps the right-side theme
337 + / notifications controls. --%>
338 + <span class={[
339 + "font-bold text-base-content shrink-0",
340 + @page_title && "hidden sm:inline"
341 + ]}>
342 + {gettext("Admin Panel")}
343 + </span>
335 344 <%!-- Current page breadcrumb: " / Page Title · subtitle".
336 345 Pushed in via page_title / page_subtitle so pages can
337 346 drop their own in-content header and reclaim the space. --%>
338 347 <span :if={@page_title} class="flex items-center gap-1.5 min-w-0">
339 - <span class="text-base-content/30 shrink-0">/</span>
340 - <span class="font-semibold text-base-content shrink-0">{@page_title}</span>
348 + <span class="text-base-content/30 shrink-0 hidden sm:inline">/</span>
349 + <span class="font-semibold text-base-content truncate min-w-0">{@page_title}</span>
341 350 <span
342 351 :if={@page_subtitle}
343 352 class="text-sm text-base-content/50 truncate hidden md:inline"
Loading more files…