lato 3.6.4 → 3.6.5
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/assets/javascripts/lato/controllers/lato_form_controller.js +11 -2
- data/app/controllers/concerns/lato/componentable.rb +2 -2
- data/app/helpers/lato/components_helper.rb +2 -0
- data/app/views/lato/components/_index.html.erb +13 -2
- data/config/locales/en.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/lib/lato/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7f9f7648617cc2047eca9dcef7856a6441ecf3baa5e13c1954cfab90434370e
|
4
|
+
data.tar.gz: fd1f0cc6ea1bbd73a87c510352f833dbe508bd157832ecf87260b3cccc675135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71e84a9a2315cb407c40652db445dec7a8f8219b9f5d36a3469214e9054cb5345e0390eb0a47119013fc9377d860791fb529a1c3590b4b5319a204920a963ccc
|
7
|
+
data.tar.gz: '09154e6115b585f655c425e95887baf9534decab16b05756c34506a5109cddacd8b5da05dd2871516e25c8b314836d570c66a81baab0cac143a0aa992c62c3a7'
|
@@ -12,7 +12,16 @@ export default class extends Controller {
|
|
12
12
|
* Stimulus
|
13
13
|
*/
|
14
14
|
|
15
|
-
connect() {
|
15
|
+
connect() {
|
16
|
+
this.hiddenSubmit = document.createElement('input')
|
17
|
+
this.hiddenSubmit.type = 'submit'
|
18
|
+
this.hiddenSubmit.style.display = 'none'
|
19
|
+
this.element.appendChild(this.hiddenSubmit)
|
20
|
+
}
|
21
|
+
|
22
|
+
disconnect() {
|
23
|
+
this.hiddenSubmit.remove()
|
24
|
+
}
|
16
25
|
|
17
26
|
/**
|
18
27
|
* Events
|
@@ -24,6 +33,6 @@ export default class extends Controller {
|
|
24
33
|
|
25
34
|
// NOTE: You can use this method to submit the form from outside the form or from custom DOM actions.
|
26
35
|
submit() {
|
27
|
-
this.
|
36
|
+
this.hiddenSubmit.click()
|
28
37
|
}
|
29
38
|
}
|
@@ -6,8 +6,8 @@ module Lato
|
|
6
6
|
# load options
|
7
7
|
# NOTE: instance variables are for options used by "lato_index" component helper
|
8
8
|
key = options[:key] || 'default'
|
9
|
-
pagination = options[:pagination] || false
|
10
9
|
default_sort_by = options[:default_sort_by] || nil
|
10
|
+
pagination = options[:pagination] || false
|
11
11
|
@_lato_index ||= {}
|
12
12
|
@_lato_index[key] = {
|
13
13
|
columns: options[:columns] || collection.column_names || [],
|
@@ -45,7 +45,7 @@ module Lato
|
|
45
45
|
# manage pagination
|
46
46
|
if pagination || params[:page] || params[:per_page]
|
47
47
|
page = params[:page]&.to_i || 1
|
48
|
-
per_page = params[:per_page]&.to_i || 25
|
48
|
+
per_page = params[:per_page]&.to_i || (pagination.is_a?(Integer) ? pagination : 25)
|
49
49
|
per_page = 100 if per_page > 100
|
50
50
|
collection = collection.page(page).per(per_page)
|
51
51
|
end
|
@@ -52,6 +52,7 @@ 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
56
|
|
56
57
|
render(
|
57
58
|
'lato/components/index',
|
@@ -62,6 +63,7 @@ module Lato
|
|
62
63
|
searchable_columns: searchable_columns,
|
63
64
|
model_name: model_name,
|
64
65
|
model_name_underscore: model_name_underscore,
|
66
|
+
pagination_options: pagination_options,
|
65
67
|
custom_actions: options[:custom_actions] || {}
|
66
68
|
)
|
67
69
|
end
|
@@ -7,7 +7,7 @@ collection_total = collection.respond_to?(:total_count) ? collection.total_count
|
|
7
7
|
|
8
8
|
<%= turbo_frame_tag "lato_index_#{key}_#{model_name_underscore}", class: "lato-index #{browser.device.mobile? ? 'lato-index-mob' : 'lato-index-desk'}" do %>
|
9
9
|
|
10
|
-
<%= form_tag request.path, method: :get, data: { turbo_frame: '_self' } do %>
|
10
|
+
<%= form_tag request.path, method: :get, data: { controller: 'lato_form', turbo_frame: '_self' } do %>
|
11
11
|
<%= hidden_field_tag :key, key %>
|
12
12
|
<% params.each do |k, v| %>
|
13
13
|
<%= hidden_field_tag k, v %>
|
@@ -132,7 +132,18 @@ collection_total = collection.respond_to?(:total_count) ? collection.total_count
|
|
132
132
|
<% else %>
|
133
133
|
<div></div>
|
134
134
|
<% end %>
|
135
|
-
<
|
135
|
+
<div class="d-flex justify-content-end align-items-center">
|
136
|
+
<span class="text-muted"><%= collection_total %> <%= I18n.t('lato.total_results').downcase %></span>
|
137
|
+
<% if pagination_options %>
|
138
|
+
<select name="per_page" class="ms-3 form-select form-select-sm w-auto" data-action="change->lato_form#submit">
|
139
|
+
<% pagination_options.each do |option| %>
|
140
|
+
<option value="<%= option %>" <%= option == params[:per_page].to_i ? 'selected' : '' %>>
|
141
|
+
<%= option %> <%= I18n.t('lato.per_page').downcase %>
|
142
|
+
</option>
|
143
|
+
<% end %>
|
144
|
+
</select>
|
145
|
+
<% end %>
|
146
|
+
</div>
|
136
147
|
</div>
|
137
148
|
</td>
|
138
149
|
</tr>
|
data/config/locales/en.yml
CHANGED
@@ -58,6 +58,7 @@ en:
|
|
58
58
|
authenticator: Two-factor authentication
|
59
59
|
authenticator_code_help: Insert the code generated by the Google Authenticator app for the account <b>%{email}</b>
|
60
60
|
reset_password: Reset your password
|
61
|
+
per_page: Per page
|
61
62
|
|
62
63
|
account_controller:
|
63
64
|
update_user_action_notice: Account information properly updated
|
data/config/locales/it.yml
CHANGED
@@ -60,6 +60,7 @@ it:
|
|
60
60
|
authenticator: Autenticazione a due fattori
|
61
61
|
authenticator_code_help: Inserisci il codice generato dall'app Google Authenticator per l'account <b>%{email}</b>
|
62
62
|
reset_password: Reimposta la tua password
|
63
|
+
per_page: Per pagina
|
63
64
|
|
64
65
|
account_controller:
|
65
66
|
update_user_action_notice: Informazioni account aggiornate correttamente
|
data/lib/lato/version.rb
CHANGED
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.6.
|
4
|
+
version: 3.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|