lato 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lato/controllers/lato_network_controller.js +53 -0
- data/app/views/layouts/lato/_network.html.erb +4 -0
- data/app/views/layouts/lato/application.html.erb +3 -3
- data/config/locales/it.yml +1 -1
- data/lib/lato/version.rb +1 -1
- data/lib/tasks/lato_tasks.rake +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37eb48c5ccc33b4bd808e09f0ef7ba16b97e9c1c8a1e6117410a03943350a35c
|
4
|
+
data.tar.gz: 0b0554a289bb6bcf5e579ae87599ece00eaee25734fb95b3353f5583a8751726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 229141372593250bccf5e3e8656108a44a0ea591900914daaf04a5017bd801ab8be3175e3bdab5ceaeb7fd6824d636eb597018d0bc86e51c874bd864d474e74c
|
7
|
+
data.tar.gz: f28efc4898d20ec4a83c13a67001c6bbf9e28773712f9dd1c30405a879e0aed9d114d5689ce462d42c756f9fb344cf9256670f904ece8edb2cf9055ad8c19979
|
@@ -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
data/lib/tasks/lato_tasks.rake
CHANGED
@@ -81,7 +81,7 @@ self.addEventListener('fetch', onFetch);
|
|
81
81
|
namespace :generate do
|
82
82
|
desc "Generate PWA icons from a single icon.png file (512x512) that should be placed inside 'public' folder"
|
83
83
|
# Usage: rails lato:generate:pwa
|
84
|
-
task :
|
84
|
+
task pwa: :environment do
|
85
85
|
# check if icon.png exists
|
86
86
|
icon_path = Rails.root.join('public', 'icon.png')
|
87
87
|
unless File.exist? icon_path
|
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: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -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
|