lato_cms 3.3.1 → 3.3.3

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: 9a5b87d2c477cafb579b7ceea01c41e72071b3a789f425e184acbe99592f63ab
4
- data.tar.gz: 123893a3b2a7c226c4910f41ab931b5bf7fd28b30b883293d811e6fc439d0155
3
+ metadata.gz: 98702b2318fec6825561794202027f26da6e3ef8b605b8575aaea4e6f41a4611
4
+ data.tar.gz: 214e49d8d9f20b5b832e825e9736ec411c7326b5dfeab542c6e5fbdf3d367698
5
5
  SHA512:
6
- metadata.gz: 23968a738f1d1295e172d546617950e2b49c900b45ac6399080a01380c97ae7ebba48414277c58565205f8229dd758b798a286a3dfb6eac55d3c1091258fad12
7
- data.tar.gz: 0a3d712b435da91e70a4a90edd8cefad81fa8105dface4946c4776490b920d3f2259c4857619d99af374e84b181aea38bc0524b2df1ef6f22532f80a141d16c5
6
+ metadata.gz: f8c8e287a719b2444120ccabb14fddbeef6f8a0f7f1b8b0a69a4e366ab7e5f24161c408f5dc1ad18227d79acfa383daa52077ca05f69115e5adf6316596aa142
7
+ data.tar.gz: 2b4cce8d2e5d2be235d70c2812313f76d554e892677e8bb11f1732c2caef458c8f9940caa7ec72f9bb54306b9bfb2f4f694c91287102722bd67a91b677c96ee9
@@ -11,7 +11,10 @@ module LatoCms
11
11
  end
12
12
 
13
13
  def show
14
- @page.fields.load
14
+ # PageField#as_json serializes both the through association and the
15
+ # Active Storage attachments. Preload the complete graph here so a
16
+ # page with many media fields does not issue one query per field/media.
17
+ @page.fields.includes(media: %i[file_attachment poster_file_attachment]).load
15
18
  render json: @page.as_json(include_fields: true)
16
19
  end
17
20
 
@@ -22,7 +22,7 @@ module LatoCms
22
22
  def lato_cms_page_actions(page, show_edit: false, show_delete: false, hide_show: false)
23
23
  btn_group = capture do
24
24
  content_tag(:div, class: 'btn-group btn-group-sm') do
25
- concat(link_to(t('lato_cms.cta_show'), lato_cms.pages_show_path(page), class: 'btn btn-primary')) unless hide_show
25
+ concat(link_to(t('lato_cms.cta_edit'), lato_cms.pages_show_path(page), class: 'btn btn-primary')) unless hide_show
26
26
  if show_edit
27
27
  concat link_to(t('lato_cms.cta_edit'), lato_cms.pages_update_path(page), class: 'btn btn-secondary',
28
28
  data: { lato_action_target: 'trigger', turbo_frame: dom_id(page, 'form'), action_title: t('lato_cms.page_update_title') })
@@ -82,7 +82,7 @@ module LatoCms
82
82
  concat content_tag(:li, content_tag(:span, t('lato_cms.action_view_frontend'), class: 'dropdown-item disabled text-muted'))
83
83
  end
84
84
  unless hide_show
85
- concat content_tag(:li, link_to(t('lato_cms.cta_show'), lato_cms.pages_show_path(page), class: 'dropdown-item'))
85
+ concat content_tag(:li, link_to(t('lato_cms.cta_edit'), lato_cms.pages_show_path(page), class: 'dropdown-item'))
86
86
  end
87
87
  if show_edit
88
88
  concat content_tag(:li, link_to(t('lato_cms.cta_edit'), lato_cms.pages_update_path(page), class: 'dropdown-item',
@@ -28,6 +28,14 @@
28
28
  data-lato-cms-media-field-target="grid"
29
29
  data-lato-cms-media-reorder-target="grid"
30
30
  <% if multiple %>data-action="dragover->lato-cms-media-reorder#onGridDragOver drop->lato-cms-media-reorder#onGridDrop"<% end %>>
31
+ <%# Always-submitted empty value: the per-item hidden inputs live inside
32
+ the tiles, so emptying the field removed every input and the param
33
+ vanished from the payload — the controller only saves fields it
34
+ receives, so the old media survived the save. This sentinel keeps the
35
+ key present (last value wins for the single-value name; blanks are
36
+ rejected for the multi-value one), so "emptied" reaches the server. %>
37
+ <input type="hidden" name="<%= hidden_name %>" value="">
38
+
31
39
  <% current_media.each do |m| %>
32
40
  <%= render partial: 'lato_cms/pages/fields/media_item', locals: { media: m, kind: kind, hidden_name: hidden_name, multiple: multiple } %>
33
41
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module LatoCms
2
- VERSION = "3.3.1"
2
+ VERSION = "3.3.3"
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.3.1
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante