lato 3.13.15 → 3.13.17

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: 6ad4bd5d3835f9473fe688987b1c0c4ae6027b80b9633e19386e50cdf5b49a28
4
- data.tar.gz: ff396184c2918d9fb5d0430632134a75c6224c330c8fece8abedb8b70e9f48d7
3
+ metadata.gz: 50ec64cfaede9534c84b28294c9923e0dcdcae866429b8d41da1e37f3a1f6d2b
4
+ data.tar.gz: bff7a67f4632b5c09ecb58764870d7464bf05bc0851594285df0fe6b6515cf70
5
5
  SHA512:
6
- metadata.gz: 9b1fa5c28d7ae84a731ba690cf45eded7679862263fbcaff76a28eccd1e90dc9f75ad92e8611240e286b6ea6edd3cf533fa36e54f0202b3dfb5ac83391d4772b
7
- data.tar.gz: da4f179ab4ffb1886d1e4ae67898fa6a76762e4f0838e5276031e35f080db13f49b7c9dfc5a654bef16364d4d442a696f06407ea83526702dfd5850b6f52022d
6
+ metadata.gz: f7970b25e4a54d3c76d55d49b5f3f31dda2d6559ca04c8ec58b0695daae3d9f3cd3f56873f4e7a209d20c3b21ed7ba3ffbaa8593536b1da8a16a318a137b9fa4
7
+ data.tar.gz: c8debda3107f8046a4594aec3c3efc210b954823915da5823109c3ed5d6390d0ee34746a437337a94337f4ea2c55ec16a39a821e944d635ded5d32ba6707230d
@@ -37,25 +37,14 @@ module Lato
37
37
  if collection.respond_to?(:lato_index_search)
38
38
  collection = collection.lato_index_search(search)
39
39
  else
40
- query_parts = @_lato_index[key][:searchable_columns].map do |column_name|
41
- # Sanitize column name per prevenire SQL injection
42
- sanitized_column = collection.quote_column_name(column_name)
43
- column_type = collection.column_for_attribute(column_name).type
44
-
45
- case column_type
46
- when :string, :text
47
- "LOWER(#{sanitized_column}) LIKE :search"
48
- when :integer, :decimal, :float
49
- "CAST(#{sanitized_column} AS TEXT) LIKE :search"
40
+ query = @_lato_index[key][:searchable_columns].map do |key|
41
+ if collection.column_for_attribute(key).type == :string || collection.column_for_attribute(key).type == :text
42
+ "LOWER(#{key}) LIKE :search"
50
43
  else
51
- "CAST(#{sanitized_column} AS TEXT) LIKE :search"
44
+ "CAST(#{key} AS TEXT) LIKE :search"
52
45
  end
53
46
  end
54
-
55
- collection = collection.where(
56
- query_parts.join(' OR '),
57
- search: "%#{search.downcase.strip}%"
58
- )
47
+ collection = collection.where(query.join(' OR '), search: "%#{search.downcase.strip}%")
59
48
  end
60
49
  end
61
50
 
@@ -52,7 +52,8 @@ module Lato
52
52
  searchable_columns = @_lato_index[key][:searchable_columns] || []
53
53
  model_name = options[:model_name] || collection.model.name
54
54
  model_name_underscore = options[:model_name] || model_name.underscore.gsub('/', '_')
55
- pagination_options = options[:pagination_options] || nil
55
+ pagination_options = options[:pagination_options] || nil,
56
+ skip_total_count = options[:skip_total_count] || false
56
57
 
57
58
  render(
58
59
  'lato/components/index',
@@ -64,6 +65,7 @@ module Lato
64
65
  model_name: model_name,
65
66
  model_name_underscore: model_name_underscore,
66
67
  pagination_options: pagination_options,
68
+ skip_total_count: skip_total_count,
67
69
  custom_actions: options[:custom_actions] || {},
68
70
  dropdown_actions: options[:dropdown_actions] || nil
69
71
  )
@@ -1,7 +1,7 @@
1
1
  <%
2
2
 
3
3
  collection_test_istance = collection.model.new
4
- collection_total = collection.respond_to?(:total_count) ? collection.total_count : collection.count
4
+ collection_total = skip_total_count ? nil : (collection.respond_to?(:total_count) ? collection.total_count : collection.count)
5
5
 
6
6
  %>
7
7
 
@@ -92,7 +92,9 @@ collection_total = collection.respond_to?(:total_count) ? collection.total_count
92
92
  </ul>
93
93
 
94
94
  <div class="d-flex flex-column align-items-center">
95
- <span class="text-muted"><%= collection_total %> <%= I18n.t('lato.total_results').downcase %></span>
95
+ <% if collection_total %>
96
+ <span class="text-muted"><%= collection_total %> <%= I18n.t('lato.total_results').downcase %></span>
97
+ <% end %>
96
98
  <% if collection.respond_to?(:total_pages) %>
97
99
  <div class="mt-3"><%= paginate collection, param_name: "#{key}_page" %></div>
98
100
  <% end %>
@@ -157,7 +159,9 @@ collection_total = collection.respond_to?(:total_count) ? collection.total_count
157
159
  <div></div>
158
160
  <% end %>
159
161
  <div class="d-flex justify-content-end align-items-center">
160
- <span class="text-muted"><%= collection_total %> <%= I18n.t('lato.total_results').downcase %></span>
162
+ <% if collection_total %>
163
+ <span class="text-muted"><%= collection_total %> <%= I18n.t('lato.total_results').downcase %></span>
164
+ <% end %>
161
165
  <% if pagination_options %>
162
166
  <select name="<%= "#{key}_per_page" %>" class="ms-3 form-select form-select-sm w-auto" data-action="change->lato-form#submit" aria-label="<%= I18n.t('lato.per_page_description') %>">
163
167
  <% pagination_options.each do |option| %>
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "3.13.15"
2
+ VERSION = "3.13.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.15
4
+ version: 3.13.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-06 00:00:00.000000000 Z
11
+ date: 2025-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails