lato_cms 3.1.4 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/lato_cms/media_controller.rb +1 -1
- data/app/models/lato_cms/media.rb +15 -0
- data/app/views/lato_cms/media/_form_update.html.erb +18 -3
- data/app/views/lato_cms/media/index.html.erb +1 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/lib/lato_cms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 335542f7d3246d07af36c41b161ab638d26f9f923823d3bedc255a943bac2197
|
|
4
|
+
data.tar.gz: a36f8acf15e683688a5344090fc7cc023d12b57371411dcbcfaba436f4f04d1a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '04776471890c80fc97fb2ff07dd3b27eaffdc54dbe7273ed5ae7f099a7bed4083fa21c26dc96d460a245ce49741b46076c9dd720cbb7516f3edea34521742759'
|
|
7
|
+
data.tar.gz: 8730a9ead03c286df9540e72c1ea1eb13ac696c536331b5dad038efa26598bacee29ae1d998243f38536b8efadfa97af9db64c6881e1adb74d5524c13a3a62e0
|
|
@@ -172,6 +172,21 @@ module LatoCms
|
|
|
172
172
|
nil
|
|
173
173
|
end
|
|
174
174
|
|
|
175
|
+
# Large uncropped variant for the admin detail view, where the 200x200
|
|
176
|
+
# square thumbnail is too small to actually judge the image. Falls back to
|
|
177
|
+
# the original blob when the file can't be processed (e.g. SVG).
|
|
178
|
+
def preview_url
|
|
179
|
+
return nil unless image? && file.attached?
|
|
180
|
+
return url unless file.variable?
|
|
181
|
+
|
|
182
|
+
Rails.application.routes.url_helpers.rails_representation_path(
|
|
183
|
+
file.variant(resize_to_limit: [1200, 1200]), only_path: true
|
|
184
|
+
)
|
|
185
|
+
rescue StandardError => e
|
|
186
|
+
Rails.logger.error("LatoCms: Failed to build preview for media #{id}: #{e.message}")
|
|
187
|
+
url
|
|
188
|
+
end
|
|
189
|
+
|
|
175
190
|
# Builds a map of { size_name => variant_url } from a field's `settings.sizes`
|
|
176
191
|
# config. The config is field-owned (different fields can request different
|
|
177
192
|
# crops of the same reused Media); the mechanics live here since Media owns
|
|
@@ -5,9 +5,24 @@
|
|
|
5
5
|
<%= lato_form_notices class: %w[mb-3] %>
|
|
6
6
|
<%= lato_form_errors media, class: %w[mb-3] %>
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
<%# Preview: images/videos get a large view (the index thumbnail is too small
|
|
9
|
+
to judge a file by), everything else keeps the small type icon. %>
|
|
10
|
+
<div class="mb-3">
|
|
11
|
+
<% if media.image? %>
|
|
12
|
+
<%= link_to media.url, target: '_blank', rel: 'noopener', title: t('lato_cms.media_open_original'),
|
|
13
|
+
class: 'd-block bg-light rounded overflow-hidden' do %>
|
|
14
|
+
<%= image_tag media.preview_url, class: 'd-block mx-auto', style: 'max-width: 100%; max-height: 420px;', alt: media.alt_text %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% elsif media.video? %>
|
|
17
|
+
<video controls preload="metadata" class="d-block w-100 rounded bg-black" style="max-height: 420px;" src="<%= media.url %>"></video>
|
|
18
|
+
<% end %>
|
|
19
|
+
|
|
20
|
+
<div class="d-flex align-items-center gap-2 mt-2">
|
|
21
|
+
<% unless media.image? || media.video? %>
|
|
22
|
+
<%= lato_cms_media_thumb(media, size: 64) %>
|
|
23
|
+
<% end %>
|
|
24
|
+
<span class="text-muted small"><%= media.filename %></span>
|
|
25
|
+
</div>
|
|
11
26
|
</div>
|
|
12
27
|
|
|
13
28
|
<div class="mb-3">
|
data/config/locales/en.yml
CHANGED
|
@@ -99,6 +99,7 @@ en:
|
|
|
99
99
|
media_create_title: Upload media
|
|
100
100
|
media_create_cta: Upload
|
|
101
101
|
media_update_title: Edit media
|
|
102
|
+
media_open_original: Open the original file in a new tab
|
|
102
103
|
media_alt_text: Alt text
|
|
103
104
|
media_alt_text_regenerate: Regenerate with AI
|
|
104
105
|
media_alt_text_regenerate_confirm: "This will overwrite the current alt text in every language with a new AI-generated one. Continue?"
|
data/config/locales/it.yml
CHANGED
|
@@ -99,6 +99,7 @@ it:
|
|
|
99
99
|
media_create_title: Carica media
|
|
100
100
|
media_create_cta: Carica
|
|
101
101
|
media_update_title: Modifica media
|
|
102
|
+
media_open_original: Apri il file originale in una nuova scheda
|
|
102
103
|
media_alt_text: Testo alternativo
|
|
103
104
|
media_alt_text_regenerate: Rigenera con AI
|
|
104
105
|
media_alt_text_regenerate_confirm: "Il testo alternativo attuale in ogni lingua verrà sostituito con uno generato dall'AI. Continuare?"
|
data/lib/lato_cms/version.rb
CHANGED