lato 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 288d8c5087ad55acbc2bd7e40a3a4dbbea45592d89b1bab4ca04fcbb367876eb
|
4
|
+
data.tar.gz: b64204ee59d0ff500f26bd37605a0d903f713dba4e4c9fb9aa6ff25395733f43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b12c8cdbd45308fd565669c44b160f99fcbdf02dab34f554b9bc6b278e000d674111b67ea6d802627cef73d341a8fbd44937e0babdd29f985f1f1b35e40975c5
|
7
|
+
data.tar.gz: 453e2ec441176eddaa105606ddf68aed5ae116cbd8b0cfb162bf6029f1eca5fbdd1cc6a29e1349ca6b42dd8b3d9da5a7feea49a9fdb4c4bfc499442e0b78687f
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static targets = [
|
5
|
+
'online',
|
6
|
+
'offline'
|
7
|
+
]
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Stimulus
|
11
|
+
*/
|
12
|
+
|
13
|
+
connect() {
|
14
|
+
window.addEventListener('online', this.onNetworkOnline.bind(this))
|
15
|
+
window.addEventListener('offline', this.onNetworkOffline.bind(this))
|
16
|
+
|
17
|
+
if (!navigator.onLine) {
|
18
|
+
this.onNetworkOffline()
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
disconnect() {
|
23
|
+
window.removeEventListener('online', this.onNetworkOnline.bind(this))
|
24
|
+
window.removeEventListener('offline', this.onNetworkOffline.bind(this))
|
25
|
+
if (this.timeout) clearTimeout(this.timeout)
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Events
|
30
|
+
*/
|
31
|
+
|
32
|
+
onNetworkOnline() {
|
33
|
+
this.element.classList.remove('d-none')
|
34
|
+
this.onlineTarget.classList.remove('d-none')
|
35
|
+
this.offlineTarget.classList.add('d-none')
|
36
|
+
|
37
|
+
if (this.timeout) clearTimeout(this.timeout)
|
38
|
+
this.timeout = setTimeout(() => {
|
39
|
+
this.element.classList.add('d-none')
|
40
|
+
}, 5000)
|
41
|
+
}
|
42
|
+
|
43
|
+
onNetworkOffline() {
|
44
|
+
this.element.classList.remove('d-none')
|
45
|
+
this.onlineTarget.classList.add('d-none')
|
46
|
+
this.offlineTarget.classList.remove('d-none')
|
47
|
+
|
48
|
+
if (this.timeout) clearTimeout(this.timeout)
|
49
|
+
this.timeout = setTimeout(() => {
|
50
|
+
this.element.classList.add('d-none')
|
51
|
+
}, 5000)
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<div class="fixed-bottom p-3 d-none" data-controller="lato-network">
|
2
|
+
<span class="badge rounded-pill text-bg-danger fs-6 d-none" data-lato-network-target="offline">You are offline</span>
|
3
|
+
<span class="badge rounded-pill text-bg-success fs-6 d-none" data-lato-network-target="online">You are online</span>
|
4
|
+
</div>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
<%= csp_meta_tag %>
|
9
9
|
|
10
|
-
|
10
|
+
<% # TEMPORARY FIX: Popper js not working using bootstrap-gem %>
|
11
11
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
|
12
12
|
|
13
13
|
<%= render 'layouts/lato/head_content' %>
|
@@ -36,8 +36,6 @@
|
|
36
36
|
</main>
|
37
37
|
</div>
|
38
38
|
|
39
|
-
|
40
|
-
|
41
39
|
<footer>
|
42
40
|
<%= render 'layouts/lato/footer' %>
|
43
41
|
</footer>
|
@@ -45,8 +43,10 @@
|
|
45
43
|
<% if @layout_sidebar %>
|
46
44
|
<%= render 'layouts/lato/aside-opener' %>
|
47
45
|
<% end %>
|
46
|
+
|
48
47
|
<%= render 'layouts/lato/feedbacks' %>
|
49
48
|
<%= render 'layouts/lato/action' %>
|
49
|
+
<%= render 'layouts/lato/network' %>
|
50
50
|
|
51
51
|
<%= render 'layouts/lato/foot_content' %>
|
52
52
|
</body>
|
data/config/locales/it.yml
CHANGED
data/lib/lato/version.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: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- app/assets/javascripts/lato/controllers/lato_form_controller.js
|
119
119
|
- app/assets/javascripts/lato/controllers/lato_hello_controller.js
|
120
120
|
- app/assets/javascripts/lato/controllers/lato_input_autocomplete_controller.js
|
121
|
+
- app/assets/javascripts/lato/controllers/lato_network_controller.js
|
121
122
|
- app/assets/javascripts/lato/controllers/lato_operation_controller.js
|
122
123
|
- app/assets/stylesheets/lato/application.scss
|
123
124
|
- app/controllers/concerns/lato/componentable.rb
|
@@ -186,6 +187,7 @@ files:
|
|
186
187
|
- app/views/layouts/lato/_navbar-brand_content.html.erb
|
187
188
|
- app/views/layouts/lato/_navbar-nav_content.html.erb
|
188
189
|
- app/views/layouts/lato/_navbar.html.erb
|
190
|
+
- app/views/layouts/lato/_network.html.erb
|
189
191
|
- app/views/layouts/lato/_sidebar-nav_content.html.erb
|
190
192
|
- app/views/layouts/lato/_sidebar.html.erb
|
191
193
|
- app/views/layouts/lato/application.html.erb
|