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 +4 -4
- data/app/models/lato_cms/media.rb +14 -0
- data/app/views/lato_cms/media/show.html.erb +8 -3
- 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: f4512bf98553bdc298352f97641aeef70356dcc448862a84816ed64ec4df3d3b
|
|
4
|
+
data.tar.gz: 7d7e190cf8997e7c9d6fcd94f7dc1570d9d939312b71a5caaa6cc2eadba697a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
12
|
-
|
|
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
|
|
data/lib/lato_cms/version.rb
CHANGED