Packages

phoenix_kit

1.7.181
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

26 files changed
+890 additions
-1009 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.180">>}.
3 + {<<"version">>,<<"1.7.181">>}.
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,
  @@ -27,7 +27,7 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Dimensions do
27 27 socket =
28 28 socket
29 29 |> assign(:current_path, Routes.path("/admin/settings/media/dimensions"))
30 - |> assign(:page_title, "Storage Dimensions")
30 + |> assign(:page_title, gettext("Instance Dimensions"))
31 31 |> assign(:project_title, project_title)
32 32 |> assign(:dimensions, dimensions)
33 33 |> assign(:current_locale, locale)
  @@ -48,12 +48,12 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Dimensions do
48 48 socket =
49 49 socket
50 50 |> assign(:dimensions, dimensions)
51 - |> put_flash(:info, "Dimension deleted successfully")
51 + |> put_flash(:info, gettext("Dimension deleted successfully"))
52 52
53 53 {:noreply, socket}
54 54
55 55 {:error, _changeset} ->
56 - socket = put_flash(socket, :error, "Failed to delete dimension")
56 + socket = put_flash(socket, :error, gettext("Failed to delete dimension"))
57 57 {:noreply, socket}
58 58 end
59 59 end
  @@ -71,12 +71,12 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Dimensions do
71 71 socket =
72 72 socket
73 73 |> assign(:dimensions, dimensions)
74 - |> put_flash(:info, "Dimension status updated")
74 + |> put_flash(:info, gettext("Dimension status updated"))
75 75
76 76 {:noreply, socket}
77 77
78 78 {:error, _changeset} ->
79 - socket = put_flash(socket, :error, "Failed to update dimension")
79 + socket = put_flash(socket, :error, gettext("Failed to update dimension"))
80 80 {:noreply, socket}
81 81 end
82 82 end
  @@ -90,12 +90,18 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Dimensions do
90 90 socket =
91 91 socket
92 92 |> assign(:dimensions, dimensions)
93 - |> put_flash(:info, "Dimensions reset to defaults successfully")
93 + |> put_flash(:info, gettext("Dimensions reset to defaults successfully"))
94 94
95 95 {:noreply, socket}
96 96
97 97 {:error, reason} ->
98 - socket = put_flash(socket, :error, "Failed to reset dimensions: #{inspect(reason)}")
98 + socket =
99 + put_flash(
100 + socket,
101 + :error,
102 + gettext("Failed to reset dimensions: %{reason}", reason: inspect(reason))
103 + )
104 +
99 105 {:noreply, socket}
100 106 end
101 107 end
  @@ -1,7 +1,7 @@
1 1 <PhoenixKitWeb.Components.LayoutWrapper.app_layout
2 2 flash={@flash}
3 3 phoenix_kit_current_scope={assigns[:phoenix_kit_current_scope]}
4 - page_title="Storage Dimensions"
4 + page_title={gettext("Instance Dimensions")}
5 5 current_path={@current_path}
6 6 current_locale={@current_locale}
7 7 project_title={@project_title}
  @@ -11,36 +11,35 @@
11 11 back={PhoenixKit.Utils.Routes.path("/admin/settings/media")}
12 12 title={gettext("Instance Dimensions")}
13 13 subtitle={gettext("Manage dimension presets for automatic file instance generation")}
14 - />
14 + >
15 + <:actions>
16 + <button
17 + phx-click="reset_dimensions_to_defaults"
18 + data-confirm={
19 + gettext(
20 + "Are you sure? This will delete all current dimensions and restore the default 8 dimensions. This action cannot be undone."
21 + )
22 + }
23 + class="btn btn-outline btn-error btn-sm"
24 + >
25 + <.icon name="hero-arrow-path" class="w-4 h-4 mr-1" /> {gettext("Reset to Defaults")}
26 + </button>
27 + </:actions>
28 + </.admin_page_header>
15 29
16 30 <%!-- Info Alert --%>
17 31 <div class="alert alert-info mb-6">
18 32 <.icon name="hero-information-circle" class="w-5 h-5" />
19 33 <div>
20 - <div class="flex justify-between items-start">
21 - <div>
22 - <h3 class="font-bold">{gettext("Dimension Presets")}</h3>
23 - <p class="text-sm">
24 - {gettext(
25 - "Dimensions define the target sizes for automatic variant generation. Images are resized and videos are transcoded to these preset sizes."
26 - )}
27 - {gettext(
28 - "The migration seeds 8 default dimensions: 4 image sizes (thumbnail, small, medium, large) and 4 video variants (360p, 720p, 1080p, video_thumbnail)."
29 - )}
30 - </p>
31 - </div>
32 - <button
33 - phx-click="reset_dimensions_to_defaults"
34 - data-confirm={
35 - gettext(
36 - "Are you sure? This will delete all current dimensions and restore the default 8 dimensions. This action cannot be undone."
37 - )
38 - }
39 - class="btn btn-error btn-sm"
40 - >
41 - <.icon name="hero-arrow-path" class="w-4 h-4 mr-1" /> {gettext("Reset to Defaults")}
42 - </button>
43 - </div>
34 + <h3 class="font-bold">{gettext("Dimension Presets")}</h3>
35 + <p class="text-sm">
36 + {gettext(
37 + "Dimensions define the target sizes for automatic variant generation. Images are resized and videos are transcoded to these preset sizes."
38 + )}
39 + {gettext(
40 + "The migration seeds 8 default dimensions: 4 image sizes (thumbnail, small, medium, large) and 4 video variants (360p, 720p, 1080p, video_thumbnail)."
41 + )}
42 + </p>
44 43 </div>
45 44 </div>
46 45
  @@ -61,7 +60,7 @@
61 60 navigate={
62 61 PhoenixKit.Utils.Routes.path("/admin/settings/media/dimensions/new/image")
63 62 }
64 - class="btn btn-info"
63 + class="btn btn-primary"
65 64 >
66 65 <.icon name="hero-plus" class="w-4 h-4 mr-1" /> {gettext("Add Image Dimension")}
67 66 </.link>
  @@ -69,7 +68,7 @@
69 68 navigate={
70 69 PhoenixKit.Utils.Routes.path("/admin/settings/media/dimensions/new/video")
71 70 }
72 - class="btn btn-warning"
71 + class="btn btn-outline"
73 72 >
74 73 <.icon name="hero-plus" class="w-4 h-4 mr-1" /> {gettext("Add Video Dimension")}
75 74 </.link>
  @@ -78,19 +77,18 @@
78 77 <% else %>
79 78 <%!-- Image Dimensions --%>
80 79 <div class="mb-8">
81 - <div class="flex justify-between items-center mb-4">
82 - <h3 class="text-2xl font-bold text-info">
83 - <.icon name="hero-photo" class="w-6 h-6 mr-2" /> {gettext("Image Dimensions")}
84 - </h3>
85 - <.link
86 - navigate={
87 - PhoenixKit.Utils.Routes.path("/admin/settings/media/dimensions/new/image")
88 - }
89 - class="btn btn-info"
90 - >
91 - <.icon name="hero-plus" class="w-4 h-4 mr-1" /> {gettext("Add Image Dimension")}
92 - </.link>
93 - </div>
80 + <.section_header icon="hero-photo" title={gettext("Image Dimensions")} class="mb-4">
81 + <:actions>
82 + <.link
83 + navigate={
84 + PhoenixKit.Utils.Routes.path("/admin/settings/media/dimensions/new/image")
85 + }
86 + class="btn btn-primary btn-sm"
87 + >
88 + <.icon name="hero-plus" class="w-4 h-4 mr-1" /> {gettext("Add Image Dimension")}
89 + </.link>
90 + </:actions>
91 + </.section_header>
94 92
95 93 <% image_dims =
96 94 Enum.filter(@dimensions, &(&1.applies_to in ["image", "both"])) %>
  @@ -279,21 +277,22 @@
279 277
280 278 <%!-- Video Dimensions --%>
281 279 <div>
282 - <div class="flex justify-between items-center mb-4">
283 - <h3 class="text-2xl font-bold text-warning">
284 - <.icon name="hero-video-camera" class="w-6 h-6 mr-2" /> {gettext(
285 - "Video Dimensions"
286 - )}
287 - </h3>
288 - <.link
289 - navigate={
290 - PhoenixKit.Utils.Routes.path("/admin/settings/media/dimensions/new/video")
291 - }
292 - class="btn btn-warning"
293 - >
294 - <.icon name="hero-plus" class="w-4 h-4 mr-1" /> {gettext("Add Video Dimension")}
295 - </.link>
296 - </div>
280 + <.section_header
281 + icon="hero-video-camera"
282 + title={gettext("Video Dimensions")}
283 + class="mb-4"
284 + >
285 + <:actions>
286 + <.link
287 + navigate={
288 + PhoenixKit.Utils.Routes.path("/admin/settings/media/dimensions/new/video")
289 + }
290 + class="btn btn-primary btn-sm"
291 + >
292 + <.icon name="hero-plus" class="w-4 h-4 mr-1" /> {gettext("Add Video Dimension")}
293 + </.link>
294 + </:actions>
295 + </.section_header>
297 296
298 297 <% video_dims =
299 298 Enum.filter(@dimensions, &(&1.applies_to in ["video", "both"])) %>
  @@ -92,7 +92,11 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
92 92 socket
93 93 |> put_flash(
94 94 :error,
95 - "Cannot set redundancy to #{requested_copies} copies. Only #{max_redundancy} active bucket(s) available."
95 + gettext(
96 + "Cannot set redundancy to %{count} copies. Only %{max} active bucket(s) available.",
97 + count: requested_copies,
98 + max: max_redundancy
99 + )
96 100 )
97 101
98 102 {:noreply, socket}
  @@ -105,13 +109,17 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
105 109 |> assign(:redundancy_copies, requested_copies)
106 110 |> put_flash(
107 111 :info,
108 - "Redundancy settings updated to #{requested_copies} #{if requested_copies == 1, do: "copy", else: "copies"}"
112 + ngettext(
113 + "Redundancy settings updated to %{count} copy",
114 + "Redundancy settings updated to %{count} copies",
115 + requested_copies
116 + )
109 117 )
110 118
111 119 {:noreply, socket}
112 120
113 121 {:error, _changeset} ->
114 - socket = put_flash(socket, :error, "Failed to update redundancy settings")
122 + socket = put_flash(socket, :error, gettext("Failed to update redundancy settings"))
115 123 {:noreply, socket}
116 124 end
117 125 end
  @@ -217,7 +225,11 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
217 225 socket
218 226 |> put_flash(
219 227 :error,
220 - "Cannot set redundancy to #{new_redundancy} copies. Only #{max_redundancy} active bucket(s) available."
228 + gettext(
229 + "Cannot set redundancy to %{count} copies. Only %{max} active bucket(s) available.",
230 + count: new_redundancy,
231 + max: max_redundancy
232 + )
221 233 )
222 234
223 235 {:noreply, socket}
  @@ -264,20 +276,20 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
264 276 |> assign(:form_annotated_thumbnails_enabled, saved_annotated_thumbnails == "true")
265 277 |> assign(:max_upload_size_mb, String.to_integer(saved_max_upload))
266 278 |> assign(:form_max_upload_size_mb, String.to_integer(saved_max_upload))
267 - |> put_flash(:info, "Storage settings updated successfully")
279 + |> put_flash(:info, gettext("Storage settings updated successfully"))
268 280
269 281 {:noreply, socket}
270 282
271 283 {{:error, _}, {:ok, _}} ->
272 - socket = put_flash(socket, :error, "Failed to update redundancy settings")
284 + socket = put_flash(socket, :error, gettext("Failed to update redundancy settings"))
273 285 {:noreply, socket}
274 286
275 287 {{:ok, _}, {:error, _}} ->
276 - socket = put_flash(socket, :error, "Failed to update variant settings")
288 + socket = put_flash(socket, :error, gettext("Failed to update variant settings"))
277 289 {:noreply, socket}
278 290
279 291 {{:error, _}, {:error, _}} ->
280 - socket = put_flash(socket, :error, "Failed to update storage settings")
292 + socket = put_flash(socket, :error, gettext("Failed to update storage settings"))
281 293 {:noreply, socket}
282 294 end
283 295 end
  @@ -294,13 +306,16 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
294 306 |> assign(:auto_generate_variants, new_value == "true")
295 307 |> put_flash(
296 308 :info,
297 - "Auto-variant generation #{if new_value == "true", do: "enabled", else: "disabled"}"
309 + if(new_value == "true",
310 + do: gettext("Auto-variant generation enabled"),
311 + else: gettext("Auto-variant generation disabled")
312 + )
298 313 )
299 314
300 315 {:noreply, socket}
301 316
302 317 {:error, _changeset} ->
303 - socket = put_flash(socket, :error, "Failed to update variant settings")
318 + socket = put_flash(socket, :error, gettext("Failed to update variant settings"))
304 319 {:noreply, socket}
305 320 end
306 321 end
  @@ -313,12 +328,12 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
313 328 socket =
314 329 socket
315 330 |> assign(:default_bucket_uuid, new_value)
316 - |> put_flash(:info, "Default bucket updated")
331 + |> put_flash(:info, gettext("Default bucket updated"))
317 332
318 333 {:noreply, socket}
319 334
320 335 {:error, _changeset} ->
321 - socket = put_flash(socket, :error, "Failed to update default bucket")
336 + socket = put_flash(socket, :error, gettext("Failed to update default bucket"))
322 337 {:noreply, socket}
323 338 end
324 339 end
  @@ -326,19 +341,23 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
326 341 def handle_event("toggle_bucket", %{"id" => bucket_uuid}, socket) do
327 342 case Storage.get_bucket(bucket_uuid) do
328 343 nil ->
329 - {:noreply, put_flash(socket, :error, "Bucket not found")}
344 + {:noreply, put_flash(socket, :error, gettext("Bucket not found"))}
330 345
331 346 bucket ->
332 347 new_enabled = !bucket.enabled
333 348
334 349 case Storage.update_bucket(bucket, %{enabled: new_enabled}) do
335 350 {:ok, _bucket} ->
336 - action = if new_enabled, do: "enabled", else: "disabled"
351 + message =
352 + if new_enabled,
353 + do: gettext("Bucket enabled successfully"),
354 + else: gettext("Bucket disabled successfully")
355 +
337 356 socket = reload_settings_data(socket)
338 - {:noreply, put_flash(socket, :info, "Bucket #{action} successfully")}
357 + {:noreply, put_flash(socket, :info, message)}
339 358
340 359 {:error, _changeset} ->
341 - {:noreply, put_flash(socket, :error, "Failed to update bucket")}
360 + {:noreply, put_flash(socket, :error, gettext("Failed to update bucket"))}
342 361 end
343 362 end
344 363 end
  @@ -358,12 +377,12 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
358 377 |> assign(:buckets, buckets)
359 378 |> assign(:active_buckets_count, active_buckets_count)
360 379 |> assign(:max_redundancy, max_redundancy)
361 - |> put_flash(:info, "Bucket deleted successfully")
380 + |> put_flash(:info, gettext("Bucket deleted successfully"))
362 381
363 382 {:noreply, socket}
364 383
365 384 {:error, _changeset} ->
366 - socket = put_flash(socket, :error, "Failed to delete bucket")
385 + socket = put_flash(socket, :error, gettext("Failed to delete bucket"))
367 386 {:noreply, socket}
368 387 end
369 388 end
  @@ -376,12 +395,21 @@ defmodule PhoenixKitWeb.Live.Modules.Storage.Settings do
376 395 socket =
377 396 socket
378 397 |> reload_settings_data()
379 - |> put_flash(:info, "Storage module repaired: #{repair_summary}")
398 + |> put_flash(
399 + :info,
400 + gettext("Storage module repaired: %{summary}", summary: repair_summary)
401 + )
380 402
381 403 {:noreply, socket}
382 404
383 405 {:error, reason} ->
384 - socket = put_flash(socket, :error, "Failed to repair: #{inspect(reason)}")
406 + socket =
407 + put_flash(
408 + socket,
409 + :error,
410 + gettext("Failed to repair: %{reason}", reason: inspect(reason))
411 + )
412 +
385 413 {:noreply, socket}
386 414 end
387 415 end
Loading more files…