lato_cms 3.2.3 → 3.2.4

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: 25204dad4edacdca80789144382c513eb02da298f4bbad559552d3d4ad3616c1
4
- data.tar.gz: 48de425da30efd01481cee27f556da6429049862a987d63087d645b156f85d78
3
+ metadata.gz: f4512bf98553bdc298352f97641aeef70356dcc448862a84816ed64ec4df3d3b
4
+ data.tar.gz: 7d7e190cf8997e7c9d6fcd94f7dc1570d9d939312b71a5caaa6cc2eadba697a3
5
5
  SHA512:
6
- metadata.gz: 8db389eef91bc7ee627a5f91f57ae02872bcb7317706d6cdc89b9ff8040efbf1a6ab6a467681bb330e0cae415796885646afdeabbe87e9023ece8bc9beab91bc
7
- data.tar.gz: 544be385fbb01838f1df124fb3582dc553f5bddbf2b18dbe1a7ff9ba4fb7d8a694bc8fb341473246d7327094140d191e002cf32d93f9e3d5dab0b545a2a49ace
6
+ metadata.gz: e4bbfabdce312042bba9014b34a8ff1423a1dccd84e0798700f334d2836f7cda389a8ce15c04faca2188229271e30e74b1b6044222e1a0735960e875c5c68206
7
+ data.tar.gz: 0f8191d661b29ce420e8ab5657511fe5c3d0af82ce0c60bd6ee11d695b86c2c27735c5d6b4ad806b9df149b46f1423e63512996e0eb99655c51da31fdac8a39f
@@ -45,6 +45,20 @@ module LatoCms
45
45
 
46
46
  scope :of_type, ->(type) { where(media_type: type) if type.present? }
47
47
 
48
+ # Hook picked up by lato's `lato_index_collection` in place of its generic
49
+ # search, whose SQL leaves column names unqualified. The Spaces association
50
+ # joins lato_spaces_groups, which also has a `name` column, so that generic
51
+ # search was ambiguous SQL and the media library's search box raised
52
+ # ("ambiguous column name: name" on SQLite, the same error on Postgres).
53
+ # Qualifying every column here fixes it; alt_text/title are matched as the
54
+ # raw JSON they're stored as, so a hit in any locale counts.
55
+ scope :lato_index_search, ->(search) {
56
+ term = "%#{search.to_s.downcase.strip}%"
57
+ columns = %w[name alt_text title].map { |column| "LOWER(#{table_name}.#{column}) LIKE :term" }
58
+
59
+ where(columns.join(" OR "), term: term)
60
+ }
61
+
48
62
  def self.infer_media_type(content_type)
49
63
  content_type = content_type.to_s
50
64
  return 'image' if content_type.start_with?('image/')
@@ -8,10 +8,15 @@
8
8
  <h2 class="fs-4 mb-0"><%= t('lato_cms.media_summary_title') %></h2>
9
9
  <%= link_to t('lato_cms.cta_edit'), lato_cms.media_update_path(@media), class: 'btn btn-sm btn-secondary' %>
10
10
  </div>
11
- <div class="card-body">
12
- <%= render 'lato_cms/media/preview', media: @media %>
11
+ <%# Two columns from lg up (preview left, data right), stacked below: the
12
+ preview is the thing you look at first, the metadata the thing you read
13
+ next to it. %>
14
+ <div class="card-body row g-4">
15
+ <div class="col-lg-5">
16
+ <%= render 'lato_cms/media/preview', media: @media %>
17
+ </div>
13
18
 
14
- <dl class="row mb-0">
19
+ <dl class="col-lg-7 row mb-0">
15
20
  <dt class="col-sm-3"><%= LatoCms::Media.human_attribute_name(:name) %></dt>
16
21
  <dd class="col-sm-9"><%= @media.name %></dd>
17
22
 
@@ -1,3 +1,3 @@
1
1
  module LatoCms
2
- VERSION = "3.2.3"
2
+ VERSION = "3.2.4"
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.2.3
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante