lato 3.13.16 → 3.13.18

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: 91f4f116e2fa3f2f95f0f0caec0b13f138505cdd243d8120cad1161b0f3a5671
4
- data.tar.gz: 9f6693227ec0fcd848d6f79614117fd93430001806ee4b9308e917bdae165589
3
+ metadata.gz: 9304badc09690e06e70b683dc178ffe057eb25a92a47bf9cea18954e0b796872
4
+ data.tar.gz: e7ebd7677622026e4d3be1d5975f4060566ee88c464640b83e3c3eff7f627de8
5
5
  SHA512:
6
- metadata.gz: ff587919ff293e11a2e71a39734919f0f50a35f1fd5e8ecabe84a6fbb3bae9438f39ed702156d2e0cb08735b9a14c74e55202887cb632c81b80f298d57d12498
7
- data.tar.gz: 3ff14b346454e96b0ea29113e3a0e9488837577cf6d22aafd637546faa605823cf0717aea1fd9a414ef8879a03334389ccf8d29080d2f238cb8f331a87da124e
6
+ metadata.gz: 2383c56456d340cf749cea8b89441a9fef6f214296a23950872ce7d34830a068f077bd1283175f3e8da4fc25039128648322a1b0bd42b14849b7a37df2310ddc
7
+ data.tar.gz: 62c77057415ddb510fb636a465bbfeef465688981a56eee17734ed4495ff57cfcf885bc1e918b2534e0afe085368dd1bd2da0b69cba03b2c6ede831da3b0d958
@@ -53,6 +53,7 @@ module Lato
53
53
  model_name = options[:model_name] || collection.model.name
54
54
  model_name_underscore = options[:model_name] || model_name.underscore.gsub('/', '_')
55
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| %>
@@ -0,0 +1,13 @@
1
+ # NOTE: Hard fix taken from https://gist.github.com/sononum/6183139 from kaminari issue https://github.com/search?q=repo%3Akaminari%2Fkaminari%20def%20total_count&type=code
2
+
3
+ module Kaminari
4
+ module PageScopeMethods
5
+ def total_count
6
+ if ActiveRecord::Base.connection.adapter_name.downcase == "postgresql"
7
+ @_hacked_total_count || (@_hacked_total_count = self.connection.execute("SELECT (reltuples)::integer FROM pg_class r WHERE relkind = 'r' AND relname ='#{table_name}'").first["reltuples"].to_i)
8
+ else
9
+ super
10
+ end
11
+ end
12
+ end
13
+ end
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "3.13.16"
2
+ VERSION = "3.13.18"
3
3
  end
data/lib/lato.rb CHANGED
@@ -9,6 +9,7 @@ require "lato/engine"
9
9
  require "lato/config"
10
10
  require "lato/btstrap"
11
11
  require "lato/dependency_helper"
12
+ require "lato/kaminari_extensions"
12
13
 
13
14
  module Lato
14
15
  class << self
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.16
4
+ version: 3.13.18
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
@@ -273,6 +273,7 @@ files:
273
273
  - lib/lato/config.rb
274
274
  - lib/lato/dependency_helper.rb
275
275
  - lib/lato/engine.rb
276
+ - lib/lato/kaminari_extensions.rb
276
277
  - lib/lato/version.rb
277
278
  - lib/tasks/lato_tasks.rake
278
279
  homepage: https://github.com/Lato-org/lato