lato 0.3.0 → 0.3.1

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: a06ea7d40cf529ec24e928cb3ad0ae2b897e4db4af3287526f8f3889e122e79f
4
- data.tar.gz: 9fb8d0fd297e86acd19e70f9e26a41b1a4d032fec68895920d972e968147cc08
3
+ metadata.gz: 288d8c5087ad55acbc2bd7e40a3a4dbbea45592d89b1bab4ca04fcbb367876eb
4
+ data.tar.gz: b64204ee59d0ff500f26bd37605a0d903f713dba4e4c9fb9aa6ff25395733f43
5
5
  SHA512:
6
- metadata.gz: 5ff61a9b5da01fc2f86e083a524ec9fa2f8d823632efd9a2d965a332130be08167940dbb8897661515d0416c2c9ed15a2392028d6ca6126e5dd978a3dc173f78
7
- data.tar.gz: 6bc388648360531a63712342f708e25506b67313ef15a52b96b18405f9c7d076c552a305a6b8816a16fb93842343e0593a6b26efafb0bf8a1c1be8a21d8b5e2d
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
- <!-- TEMPORARY FIX: Popper js not working using bootstrap-gem -->
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>
@@ -57,7 +57,7 @@ it:
57
57
  first_name: Nome
58
58
  last_name: Cognome
59
59
  password_confirmation: Conferma password
60
- email: Indirizzo email
60
+ email: Email
61
61
  accepted_privacy_policy_version: Privacy policy
62
62
  accepted_terms_and_conditions_version: Termini e condizioni
63
63
  errors:
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.0
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