lato 3.17.0 → 3.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 693630b5ecdde3bd76143d39982e7313c266188c30a1dbbd41b482a56db541c7
4
- data.tar.gz: 77c4a9d2ae92e3669f1936590cc8b2bf5799ccfea9eccd904965d9c51cb26ffa
3
+ metadata.gz: a1135b4284e1c761094754ca918919b81d13159ca05b63e9fc4af80a4b7fe949
4
+ data.tar.gz: 41505b5b1f4ad8124ccba0cbd25acc26b595e83bb8278119f0ace6c2d8570931
5
5
  SHA512:
6
- metadata.gz: f56cbc6971fbe27fc566edea26979f3912f6133e47e71c9b11089aa1f035e66e41600179cad6f52be6b622d0dbd3780ce7c4226108a65dc57c3e3d004268cbe2
7
- data.tar.gz: a9a0c32cfb747eceaf5dde8ec03c3590eb441a3ce24f53987618835bb5a315c8e1a9c9e4d106b5bcf314f4e2e52479d22cfdb62603cc853c969a774f197b4ae0
6
+ metadata.gz: 692216d780c5248e54a9352cc1630953ced6d0864775dff1ed60d19256f82e5a301a7aed32c4695a33b2cbc4a14f1fa3721fba5240613c6afbb76c5d6d97b6dd
7
+ data.tar.gz: ee8f6ebe85e6b73539b432ebe29c8515f8f87fd72c839c12072f77d7962a949635825b0ff217731727d236d295d0bee6c2c25300e41a7657db01ca139dc4e8c5
data/README.md CHANGED
@@ -154,18 +154,3 @@ ruby ./bin/generate_docs.rb
154
154
 
155
155
  ## License
156
156
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
157
-
158
- Stiamo integrando l'autenticazione WebAuthn nel pannello Lato.
159
- L'idea è che l'utente, dal suo account, può, volontariamente, attivare l'autenticazione WebAuthn per il suo account.
160
- Una volta attivata, al login, dopo aver inserito email e password, l'utente dovrà autenticarsi con il dispositivo WebAuthn registrato (ad esempio una chiave di sicurezza FIDO2 o l'autenticazione biometrica del dispositivo).
161
- Se è attiva anche l'autenticazione a due fattori con Google Authenticator, l'utente dovrà scegliere quale dei due metodi utilizzare per completare l'autenticazione.
162
-
163
- Il modello Lato::User ha già i campi webauthn_id e webauthn_public_key da utilizzati per memorizzare le informazioni del dispositivo WebAuthn registrato.
164
-
165
- Modifica il flow di login per includere il passaggio di autenticazione WebAuthn se l'utente ha un dispositivo WebAuthn registrato.
166
-
167
- La logica dovrebbe essere la seguente:
168
- - Se Google Auth e WebAuthn non sono attivi o se l'utente non li ha collegati, il login procede normalmente.
169
- - Se solo Google Auth è attivo e l'utente lo ha collegato, dopo aver inserito email e password, l'utente viene reindirizzato alla pagina di inserimento del codice di Google Authenticator.
170
- - Se solo WebAuthn è attivo e l'utente lo ha collegato, dopo aver inserito email e password, l'utente viene reindirizzato alla pagina di autenticazione WebAuthn.
171
- - Se entrambi sono attivi e l'utente li ha collegati, dopo aver inserito email e password, l'utente deve scegliere quale metodo utilizzare per completare l'autenticazione.
@@ -2,12 +2,21 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
 
5
+ connect() {
6
+ this.loadHiddenPreferenceFromCookies()
7
+ }
8
+
5
9
  /**
6
10
  * Functions
7
11
  */
8
12
 
9
13
  toggle() {
10
- document.body.classList.toggle('aside-open')
14
+ if (this.isMobile()) {
15
+ document.body.classList.toggle('aside-open')
16
+ } else {
17
+ document.body.classList.toggle('aside-hidden')
18
+ this.updateHiddenPreferenceOnCookies(document.body.classList.contains('aside-hidden'))
19
+ }
11
20
  }
12
21
 
13
22
  /**
@@ -16,6 +25,37 @@ export default class extends Controller {
16
25
 
17
26
  onClickToggle(e) {
18
27
  e.preventDefault()
19
- document.body.classList.toggle('aside-open')
28
+ if (this.isMobile()) {
29
+ document.body.classList.toggle('aside-open')
30
+ } else {
31
+ document.body.classList.toggle('aside-hidden')
32
+ this.updateHiddenPreferenceOnCookies(document.body.classList.contains('aside-hidden'))
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Helpers
38
+ */
39
+
40
+ isMobile() {
41
+ return window.innerWidth <= 1024
42
+ }
43
+
44
+ updateHiddenPreferenceOnCookies(hidden) {
45
+ const date = new Date()
46
+ date.setTime(date.getTime() + (365*24*60*60*1000)) // 1 year
47
+ document.cookie = `lato_aside_hidden=${hidden}; expires=${date.toUTCString()}; path=/`
48
+ }
49
+
50
+ loadHiddenPreferenceFromCookies() {
51
+ const match = document.cookie.match(new RegExp('(^| )lato_aside_hidden=([^;]+)'))
52
+ if (match) {
53
+ const hidden = match[2] === 'true'
54
+ if (hidden) {
55
+ document.body.classList.add('aside-hidden')
56
+ } else {
57
+ document.body.classList.remove('aside-hidden')
58
+ }
59
+ }
20
60
  }
21
61
  }
@@ -53,6 +53,12 @@ main {
53
53
  @media screen and (max-width: 1024px) {
54
54
  width: 100%;
55
55
  }
56
+
57
+ @media screen and (min-width: 1025px) {
58
+ .aside-hidden & {
59
+ width: 100%;
60
+ }
61
+ }
56
62
  }
57
63
  }
58
64
 
@@ -66,6 +72,12 @@ aside {
66
72
  position: absolute;
67
73
  right: 0.5rem;
68
74
  }
75
+
76
+ @media screen and (min-width: 1025px) {
77
+ .aside-hidden & {
78
+ display: none;
79
+ }
80
+ }
69
81
  }
70
82
 
71
83
  main, aside {
@@ -74,10 +86,10 @@ main, aside {
74
86
  }
75
87
 
76
88
  .aside-opener {
77
- display: none;
89
+ display: flex;
78
90
  position: fixed;
79
91
  bottom: 15px;
80
- right: 15px;
92
+ left: 15px;
81
93
  z-index: 100;
82
94
  background-color: $primary;
83
95
  color: $white;
@@ -89,6 +101,11 @@ main, aside {
89
101
  justify-content: center;
90
102
  align-items: center;
91
103
  border-radius: 50%;
104
+
105
+ @media screen and (max-width: 1024px) {
106
+ left: initial;
107
+ right: 15px;
108
+ }
92
109
  }
93
110
 
94
111
  @media screen and (max-width: 1024px) {
@@ -112,10 +129,6 @@ main, aside {
112
129
  transform: translateX(0);
113
130
  }
114
131
  }
115
-
116
- .aside-opener {
117
- display: flex;
118
- }
119
132
  }
120
133
 
121
134
  .lato-index {
@@ -1,26 +1,17 @@
1
- <% if params[:generate_docs] %>
2
- <%= lato_navbar_nav_item :tutorial, main_app.tutorial_path do %>
3
- Tutorial
1
+ <% if @session.valid? %>
2
+ <%= lato_navbar_nav_item :account, lato.account_path do %>
3
+ <%= I18n.t('lato.account') %>
4
4
  <% end %>
5
- <%= lato_navbar_nav_item :github, 'https://github.com/Lato-org/lato' do %>
6
- Github
5
+ <%= lato_navbar_nav_item :authentication_logout, lato.authentication_signout_path do %>
6
+ <%= I18n.t('lato.signout') %>
7
7
  <% end %>
8
8
  <% else %>
9
- <% if @session.valid? %>
10
- <%= lato_navbar_nav_item :account, lato.account_path do %>
11
- <%= I18n.t('lato.account') %>
12
- <% end %>
13
- <%= lato_navbar_nav_item :authentication_logout, lato.authentication_signout_path do %>
14
- <%= I18n.t('lato.signout') %>
15
- <% end %>
16
- <% else %>
17
- <%= lato_navbar_nav_item :authentication_signin, lato.authentication_signin_path do %>
18
- <%= I18n.t('lato.signin') %>
19
- <% end %>
20
- <%= lato_navbar_nav_item :authentication_signup, lato.authentication_signup_path do %>
21
- <%= I18n.t('lato.signup') %>
22
- <% end %>
9
+ <%= lato_navbar_nav_item :authentication_signin, lato.authentication_signin_path do %>
10
+ <%= I18n.t('lato.signin') %>
23
11
  <% end %>
12
+ <%= lato_navbar_nav_item :authentication_signup, lato.authentication_signup_path do %>
13
+ <%= I18n.t('lato.signup') %>
14
+ <% end %>
15
+ <% end %>
24
16
 
25
- <%= lato_navbar_nav_locales_item(flag: true) %>
26
- <% end %>
17
+ <%= lato_navbar_nav_locales_item(flag: true) %>
@@ -24,7 +24,7 @@
24
24
  <%= javascript_importmap_tags Lato.config.assets_importmap_entry %>
25
25
  </head>
26
26
  <body
27
- class="controller-<%= controller_name %> action-<%= action_name %> <%= @layout_body_classes.join(' ') %>"
27
+ class="controller-<%= controller_name %> action-<%= action_name %> <%= @layout_body_classes.join(' ') %> <%= cookies[:lato_aside_hidden] == 'true' ? 'aside-hidden' : '' %>"
28
28
  data-controller="lato-action lato-guide"
29
29
  >
30
30
  <header>
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "3.17.0"
2
+ VERSION = "3.18.0"
3
3
  end
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.17.0
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-07 00:00:00.000000000 Z
11
+ date: 2025-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails