lato_cms 3.1.1 → 3.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bb418bbe488978095559ae9b357d135817dfabc9b07758a4d4de227c64193bd
4
- data.tar.gz: eecb8e9c4dc67d3407a50fefffc3886a6000fbafeee2ad559b796abffd725b1f
3
+ metadata.gz: 2c31c3c48793c6d20d23de01e4ccf7e42d9086d299e7ae5b713061e5ddd8861b
4
+ data.tar.gz: 0f575950a6a54cf1f4321fd9127297a8c1941c4684b7b7ccaefbe251e67a4aa4
5
5
  SHA512:
6
- metadata.gz: 3ecd3728c992b947b2b44c1caaa5caa0dcb6629aab9dfccc5fbf7a197288e34b78eaf05f76d58feac3739b4dd42c1c7173e298e86789681efd37dcedcfaa55d0
7
- data.tar.gz: 83671037f9b74b4044459782c9adf708b1cd99cbdb4f9b3fa95a2d6c3f3b2f692dd177c8c1d970b8b33a5fb5a416a1402a433d1122047089cad2198580515229
6
+ metadata.gz: d67ec60c551ffb117fc461d00b1279f058dfb2f8a3ffcd5b72a30f7eb4e05c5494811d4dedee733c41409fca5232774ac8818a90a3b30f70b7697fbeed72f86c
7
+ data.tar.gz: f09db9cfb78554e68063210c37f46621b42ce4131ed9e2d849d68409056a76e218cd26c2cc8af0dd9c771318052828147dde86ea2e7d306dc55f939cf0f17518
@@ -94,8 +94,10 @@ export default class extends Controller {
94
94
  appendItem (item) {
95
95
  if (!item || this.gridTarget.querySelector(`[data-media-id="${item.id}"]`)) return
96
96
 
97
+ const wide = !this.multipleValue && ['image', 'video'].includes(this.kindValue)
98
+
97
99
  const wrapper = document.createElement('div')
98
- wrapper.className = 'lato-cms-media-field__tile lato-cms-media-field__item'
100
+ wrapper.className = `lato-cms-media-field__tile lato-cms-media-field__item${wide ? ' lato-cms-media-field__tile--wide' : ''}`
99
101
  wrapper.dataset.mediaId = item.id
100
102
  if (this.multipleValue) {
101
103
  wrapper.draggable = true
@@ -118,8 +120,7 @@ export default class extends Controller {
118
120
 
119
121
  previewMarkup (item) {
120
122
  if (this.kindValue === 'video') {
121
- return `<video muted preload="metadata" class="lato-cms-media-field__player" src="${item.url}"></video>
122
- <i class="bi bi-play-circle-fill lato-cms-media-field__badge"></i>`
123
+ return `<video controls preload="metadata" class="lato-cms-media-field__player" src="${item.url}"></video>`
123
124
  }
124
125
  if (item.thumbnailUrl || item.url) {
125
126
  return `<img src="${item.thumbnailUrl || item.url}" class="lato-cms-media-field__thumb">`
@@ -212,6 +212,15 @@ body.controller-pages.action-show {
212
212
  width: 110px;
213
213
  }
214
214
 
215
+ // Single image/video fields (never galleries, never plain files): a full-width
216
+ // preview reads much better than a 110px square, and gives a real video
217
+ // player enough room to be usable.
218
+ .lato-cms-media-field__tile--wide {
219
+ aspect-ratio: 16 / 9;
220
+ height: auto;
221
+ width: 100%;
222
+ }
223
+
215
224
  .lato-cms-media-field__item {
216
225
  background: var(--bs-light);
217
226
  border: 1px solid rgba(33, 37, 41, 0.1);
@@ -253,16 +262,6 @@ body.controller-pages.action-show {
253
262
  width: 100%;
254
263
  }
255
264
 
256
- .lato-cms-media-field__badge {
257
- bottom: 4px;
258
- color: #fff;
259
- filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
260
- font-size: 0.9rem;
261
- pointer-events: none;
262
- position: absolute;
263
- right: 4px;
264
- }
265
-
266
265
  // Name overlay: hidden until the tile is hovered.
267
266
  .lato-cms-media-field__overlay {
268
267
  bottom: 0;
@@ -10,6 +10,7 @@
10
10
  lato_cms_field_input_name(field_id, 'media_ids', input_name_prefix: local_assigns[:input_name_prefix], multiple: true) :
11
11
  lato_cms_field_input_name(field_id, 'media_id', input_name_prefix: local_assigns[:input_name_prefix]) %>
12
12
  <% picker_type = kind == 'file' ? nil : kind %>
13
+ <% wide = !multiple && %w[image video].include?(kind) %>
13
14
 
14
15
  <label class="form-label">
15
16
  <%= label %><%= ' *' if required %>
@@ -42,7 +43,7 @@
42
43
  default navigation itself and sets the frame's `src` explicitly
43
44
  (Turbo's documented, non-racy way to trigger a frame-scoped fetch). %>
44
45
  <%= link_to lato_cms.media_picker_action_path(frame_id: frame_id, multiple: multiple, type: picker_type),
45
- class: "lato-cms-media-field__tile lato-cms-media-field__tile--add#{' d-none' if !multiple && current_media.any?}",
46
+ class: "lato-cms-media-field__tile lato-cms-media-field__tile--add#{' lato-cms-media-field__tile--wide' if wide}#{' d-none' if !multiple && current_media.any?}",
46
47
  data: {
47
48
  lato_cms_media_field_target: 'addTile',
48
49
  action: 'click->lato-cms-media-field#openPicker',
@@ -1,4 +1,5 @@
1
- <div class="lato-cms-media-field__tile lato-cms-media-field__item"
1
+ <% wide = !multiple && %w[image video].include?(kind) %>
2
+ <div class="lato-cms-media-field__tile lato-cms-media-field__item<%= ' lato-cms-media-field__tile--wide' if wide %>"
2
3
  data-media-id="<%= media.id %>"
3
4
  data-lato-cms-media-field-target="item"
4
5
  <% if multiple %>
@@ -7,8 +8,7 @@
7
8
  data-action="dragstart->lato-cms-media-reorder#onDragStart dragend->lato-cms-media-reorder#onDragEnd"
8
9
  <% end %>>
9
10
  <% if kind == 'video' %>
10
- <video muted preload="metadata" class="lato-cms-media-field__player" src="<%= media.url %>"></video>
11
- <i class="bi bi-play-circle-fill lato-cms-media-field__badge"></i>
11
+ <video controls preload="metadata" class="lato-cms-media-field__player" src="<%= media.url %>"></video>
12
12
  <% elsif media.thumbnail_url %>
13
13
  <img src="<%= media.thumbnail_url %>" class="lato-cms-media-field__thumb" alt="<%= media.alt_text %>">
14
14
  <% else %>
@@ -1,3 +1,3 @@
1
1
  module LatoCms
2
- VERSION = "3.1.1"
2
+ VERSION = "3.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante