lato 3.19.8 → 3.22.0
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/README.md +4 -2
- data/app/assets/javascripts/lato/application.js +28 -11
- data/app/assets/javascripts/lato/controllers/lato_confirm_controller.js +2 -2
- data/app/controllers/concerns/lato/componentable.rb +18 -7
- data/app/controllers/lato/application_controller.rb +2 -0
- data/app/views/lato/components/_operation.html.erb +2 -2
- data/config/importmap.rb +1 -0
- data/lib/lato/version.rb +1 -1
- data/lib/lato.rb +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 925e5dd4e3c5460a38172e5f67acaf5130c15e080777a91330becf009888dd52
|
|
4
|
+
data.tar.gz: 672b343b2de9def169bc3a97314b4ccee9db6f3254f89fb42f3e5c3ae17de863
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b558bf2e8b153d3c173d1219b0689147611f341e80a9454634247bcf830cf378fb6780045ece64ecd54d42b34efb57e246e66d89e292aa67cd7ad4c7ba13536
|
|
7
|
+
data.tar.gz: dfd3b28e1322227882c6b8b1432b6119cb3678cedb28b6cadde4fce09358b31d451b1297af664f0f6c03a26df10cdb7c0e1cf8d2b10ef4ecabea24c69e36cd67
|
data/README.md
CHANGED
|
@@ -21,9 +21,11 @@ The gem is ready to be used with the **latest Rails 7+** features like **[ESM im
|
|
|
21
21
|
|
|
22
22
|
The full documentation is available here: 👉 👉 [DOCUMENTATION](https://lato-oss.gregoriogalante.com) 👈 👈
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
### Working with LLMs
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The `SKILL.md` usable with LLMs to generate code and get helps with the gem is available here: 👉 [SKILL.md](https://github.com/Lato-org/lato/raw/refs/heads/main/docs/SKILL.md) 👈
|
|
27
|
+
|
|
28
|
+
The `documentation.txt` file with all the context to use with LLMs is available here: 👉 [documentation.txt](https://github.com/Lato-org/lato/raw/refs/heads/main/docs/documentation.txt) 👈
|
|
27
29
|
|
|
28
30
|
## Eco-system
|
|
29
31
|
The idea behind Lato is to create an eco-system of engines that can improve the functionalities of the panel. The following engines are already available:
|
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
// Import turbo rails
|
|
2
|
-
import
|
|
2
|
+
import '@hotwired/turbo-rails'
|
|
3
3
|
// Import bootstrap js
|
|
4
|
-
import
|
|
4
|
+
import 'bootstrap'
|
|
5
5
|
// Import controllers (stimulus rails)
|
|
6
|
-
import
|
|
6
|
+
import 'controllers'
|
|
7
|
+
// Import local time js
|
|
8
|
+
import LocalTime from 'local-time'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Setup local time to update time elements on page load and after turbo morph or frame render
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
LocalTime.start()
|
|
15
|
+
|
|
16
|
+
document.addEventListener('turbo:morph', () => {
|
|
17
|
+
LocalTime.run()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
document.addEventListener('turbo:frame-render', () => {
|
|
21
|
+
LocalTime.run()
|
|
22
|
+
})
|
|
7
23
|
|
|
8
24
|
/**
|
|
9
25
|
* Include service worker
|
|
10
26
|
*/
|
|
11
27
|
|
|
12
28
|
if (navigator.serviceWorker) {
|
|
13
|
-
navigator.serviceWorker
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
navigator.serviceWorker
|
|
30
|
+
.register('/service-worker.js', { scope: '/' })
|
|
31
|
+
.then(() => navigator.serviceWorker.ready)
|
|
32
|
+
.then((registration) => {
|
|
33
|
+
const event = new window.CustomEvent('service-worker:ready', { detail: registration })
|
|
34
|
+
document.dispatchEvent(event)
|
|
35
|
+
})
|
|
36
|
+
.then(() => window.console.log('[App]', 'Service worker registered! -> listen to \'service-worker:ready\' document event to get registration object'))
|
|
20
37
|
}
|
|
21
38
|
|
|
22
39
|
/**
|
|
@@ -24,7 +41,7 @@ if (navigator.serviceWorker) {
|
|
|
24
41
|
* https://github.com/hotwired/turbo-rails/issues/440
|
|
25
42
|
*/
|
|
26
43
|
|
|
27
|
-
document.addEventListener(
|
|
44
|
+
document.addEventListener('turbo:frame-missing', event => {
|
|
28
45
|
event.preventDefault()
|
|
29
46
|
event.detail.visit(event.detail.response)
|
|
30
47
|
})
|
|
@@ -7,7 +7,7 @@ export default class extends Controller {
|
|
|
7
7
|
|
|
8
8
|
connect() {
|
|
9
9
|
this.modal = new bootstrap.Modal(this.element)
|
|
10
|
-
Turbo.
|
|
10
|
+
Turbo.config.forms.confirm = this.customConfirm.bind(this)
|
|
11
11
|
|
|
12
12
|
this.element.addEventListener('show.bs.modal', () => {
|
|
13
13
|
this.element.style.zIndex = 2001
|
|
@@ -21,7 +21,7 @@ export default class extends Controller {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
disconnect() {
|
|
24
|
-
Turbo.
|
|
24
|
+
Turbo.config.forms.confirm = window.confirm
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async customConfirm(message) {
|
|
@@ -20,14 +20,12 @@ module Lato
|
|
|
20
20
|
|
|
21
21
|
# manage sort by parameter
|
|
22
22
|
unless params["#{key}_sort_by"].blank?
|
|
23
|
-
|
|
24
|
-
sort_by_column = sort_by_splitted.first
|
|
25
|
-
sort_by_order = sort_by_splitted.last
|
|
23
|
+
sort_by = parse_lato_index_sort_by(params["#{key}_sort_by"], @_lato_index[key][:sortable_columns])
|
|
26
24
|
|
|
27
|
-
if collection.respond_to?(:lato_index_order)
|
|
28
|
-
collection = collection.lato_index_order(
|
|
29
|
-
|
|
30
|
-
collection = collection.order(
|
|
25
|
+
if sort_by && collection.respond_to?(:lato_index_order)
|
|
26
|
+
collection = collection.lato_index_order(sort_by[:column].to_sym, sort_by[:order].to_sym)
|
|
27
|
+
elsif sort_by
|
|
28
|
+
collection = collection.order(sort_by[:column] => sort_by[:order])
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
|
|
@@ -63,5 +61,18 @@ module Lato
|
|
|
63
61
|
|
|
64
62
|
collection
|
|
65
63
|
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def parse_lato_index_sort_by(sort_by, sortable_columns)
|
|
68
|
+
sort_by_column, sort_by_order = sort_by.to_s.split("|", 2)
|
|
69
|
+
sort_by_column = sort_by_column.to_s
|
|
70
|
+
sort_by_order = sort_by_order.to_s.downcase
|
|
71
|
+
|
|
72
|
+
return unless sortable_columns.map(&:to_s).include?(sort_by_column)
|
|
73
|
+
return unless %w[asc desc].include?(sort_by_order)
|
|
74
|
+
|
|
75
|
+
{ column: sort_by_column, order: sort_by_order }
|
|
76
|
+
end
|
|
66
77
|
end
|
|
67
78
|
end
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
<% operation.logs.reverse.each do |log| %>
|
|
75
75
|
<div class="mb-2 pb-2 border-bottom d-flex justify-content-between align-items-center">
|
|
76
76
|
<p class="mb-0"><%= log[1] %></p>
|
|
77
|
-
<small class="
|
|
77
|
+
<small class="ms-4"><%= local_time(Time.parse(log[0]), format: "%H:%M:%S", class: "text-muted") %></small>
|
|
78
78
|
</div>
|
|
79
79
|
<% end %>
|
|
80
80
|
</div>
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
<%= link_to '', lato.operation_path(operation), class: 'd-none', data: { lato_operation_target: 'update', turbo_frame: '_self' } %>
|
|
86
86
|
<% end %>
|
|
87
87
|
</div>
|
|
88
|
-
<% end %>
|
|
88
|
+
<% end %>
|
data/config/importmap.rb
CHANGED
|
@@ -5,4 +5,5 @@ pin "@rails/activestorage", to: "activestorage.esm.js", preload: true
|
|
|
5
5
|
|
|
6
6
|
pin "bootstrap", to: "bootstrap.js", preload: true
|
|
7
7
|
# pin "@popperjs/core", to: "popper.js", preload: true
|
|
8
|
+
pin "local-time", to: "https://ga.jspm.io/npm:local-time@3.0.3/app/assets/javascripts/local-time.es2017-esm.js"
|
|
8
9
|
pin "lodash", to: "https://ga.jspm.io/npm:lodash@4.17.21/lodash.js"
|
data/lib/lato/version.rb
CHANGED
data/lib/lato.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lato
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.22.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gregorio Galante
|
|
@@ -79,6 +79,20 @@ dependencies:
|
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: local_time
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
82
96
|
- !ruby/object:Gem::Dependency
|
|
83
97
|
name: browser
|
|
84
98
|
requirement: !ruby/object:Gem::Requirement
|