lato 3.8.1 → 3.10.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/app/assets/javascripts/lato/controllers/lato_input_autocomplete2_controller.js +115 -0
- data/app/assets/javascripts/lato/controllers/lato_input_autocomplete_controller.js +1 -1
- data/app/assets/stylesheets/lato/application.scss +6 -6
- data/app/mailers/lato/invitation_mailer.rb +1 -1
- data/app/mailers/lato/user_mailer.rb +15 -2
- data/app/models/lato/user.rb +2 -0
- data/app/views/lato/mailer/user/signin_success_mail.html.erb +15 -0
- data/app/views/layouts/lato/application.html.erb +1 -1
- data/config/locales/en.yml +7 -0
- data/config/locales/it.yml +7 -0
- data/lib/lato/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 661a7fa10069cfd8f228e56bcad9a55c615b055d85b3139ec50e919fad27cbfd
|
|
4
|
+
data.tar.gz: 3e3ea5c20ac55f92fec12241492cb09bc642d05e6ad2e0f5e9ba45c1eec9fe25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3246a40201e0367461efbac8cc4d634e0f32164308d1fbb3c5d9c24f501441773c2ddc880e30b7a67f2e2037276eff0f6d9adf0fcb339a167ec6512b47494543
|
|
7
|
+
data.tar.gz: 61cf36ca2a1087aa804d93335fa4344f2103a7b5b02840e5ed09ec4b8c648bcf03e5307df0d27960f5089d6fbcd6c0f937d3f34aba8a980f051471ed00a7007d
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
import _ from 'lodash'
|
|
3
|
+
|
|
4
|
+
export default class extends Controller {
|
|
5
|
+
static values = {
|
|
6
|
+
path: String
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Stimulus
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
connect() {
|
|
14
|
+
this.search = _.debounce(this.search, 500)
|
|
15
|
+
|
|
16
|
+
this.realInput = document.createElement('input')
|
|
17
|
+
this.realInput.type = 'hidden'
|
|
18
|
+
this.realInput.name = this.element.getAttribute('name')
|
|
19
|
+
this.realInput.value = this.element.value
|
|
20
|
+
this.element.insertAdjacentElement('afterend', this.realInput)
|
|
21
|
+
|
|
22
|
+
if (this.element.value) {
|
|
23
|
+
this.setDefaultElementValue()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.element.addEventListener('keyup', (e) => {
|
|
27
|
+
this.search(e.target.value)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
window.addEventListener('click', this.onWindowClick.bind(this))
|
|
31
|
+
window.addEventListener('scroll', this.onWindowScroll.bind(this))
|
|
32
|
+
window.addEventListener('resize', this.onWindowResize.bind(this))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
disconnect() {
|
|
36
|
+
this.realInput.remove()
|
|
37
|
+
this.suggestHide()
|
|
38
|
+
|
|
39
|
+
window.removeEventListener('click', this.onWindowClick.bind(this))
|
|
40
|
+
window.removeEventListener('scroll', this.onWindowScroll.bind(this))
|
|
41
|
+
window.removeEventListener('resize', this.onWindowResize.bind(this))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async search(value) {
|
|
45
|
+
this.realInput.value = ''
|
|
46
|
+
if (!value || value.length < 3) return
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const response = await fetch(this.pathValue + '?q=' + value)
|
|
50
|
+
const data = await response.json()
|
|
51
|
+
this.suggestShow(data)
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error(err)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
suggestShow(data = []) {
|
|
58
|
+
if (this.optionsList) this.optionsList.remove()
|
|
59
|
+
this.optionsList = document.createElement('ul')
|
|
60
|
+
this.optionsList.classList.add('list-group')
|
|
61
|
+
this.optionsList.style.position = 'fixed'
|
|
62
|
+
this.optionsList.style.width = this.element.offsetWidth + 'px'
|
|
63
|
+
this.optionsList.style.maxHeight = '200px'
|
|
64
|
+
this.optionsList.style.overflowY = 'auto'
|
|
65
|
+
this.optionsList.style.zIndex = 9999
|
|
66
|
+
|
|
67
|
+
const elementRect = this.element.getBoundingClientRect()
|
|
68
|
+
this.optionsList.style.top = elementRect.bottom + 'px'
|
|
69
|
+
this.optionsList.style.left = elementRect.left + 'px'
|
|
70
|
+
|
|
71
|
+
data.forEach((option) => {
|
|
72
|
+
const li = document.createElement('li')
|
|
73
|
+
li.classList.add('list-group-item')
|
|
74
|
+
li.classList.add('list-group-item-action')
|
|
75
|
+
li.style.cursor = 'pointer'
|
|
76
|
+
li.innerText = typeof option == 'string' ? option : option.label
|
|
77
|
+
li.addEventListener('click', () => {
|
|
78
|
+
this.element.value = typeof option == 'string' ? option : option.label
|
|
79
|
+
this.realInput.value = typeof option == 'string' ? option : option.value
|
|
80
|
+
this.suggestHide()
|
|
81
|
+
})
|
|
82
|
+
this.optionsList.appendChild(li)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
document.body.appendChild(this.optionsList)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
suggestHide() {
|
|
89
|
+
if (this.optionsList) this.optionsList.remove()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async setDefaultElementValue() {
|
|
93
|
+
try {
|
|
94
|
+
const response = await fetch(this.pathValue + '?value=' + this.element.value)
|
|
95
|
+
const data = await response.json()
|
|
96
|
+
this.element.value = data?.label || this.element.value
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.error(err)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
onWindowClick(event) {
|
|
103
|
+
if (!this.element.contains(event.target)) {
|
|
104
|
+
this.suggestHide()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
onWindowScroll(event) {
|
|
109
|
+
this.suggestHide()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
onWindowResize(event) {
|
|
113
|
+
this.suggestHide()
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** Import dependencies */
|
|
2
2
|
|
|
3
|
-
$primary: #
|
|
4
|
-
$secondary: #
|
|
5
|
-
$success: #
|
|
6
|
-
$danger: #
|
|
7
|
-
$warning: #
|
|
8
|
-
$info: #
|
|
3
|
+
$primary: #293b5a !default;
|
|
4
|
+
$secondary: #7b96c4 !default;
|
|
5
|
+
$success: #26b75e !default;
|
|
6
|
+
$danger: #e32908 !default;
|
|
7
|
+
$warning: #ffae03 !default;
|
|
8
|
+
$info: #00c8e7 !default;
|
|
9
9
|
|
|
10
10
|
$gray-100: #ebeff4 !default;
|
|
11
11
|
$gray-200: #dde3e9 !default;
|
|
@@ -8,7 +8,7 @@ module Lato
|
|
|
8
8
|
|
|
9
9
|
mail(
|
|
10
10
|
to: @user.email,
|
|
11
|
-
subject: '
|
|
11
|
+
subject: I18n.t('lato.user_mailer.email_verification_mail_subject'),
|
|
12
12
|
template_path: 'lato/mailer/user'
|
|
13
13
|
)
|
|
14
14
|
end
|
|
@@ -21,7 +21,20 @@ module Lato
|
|
|
21
21
|
|
|
22
22
|
mail(
|
|
23
23
|
to: @user.email,
|
|
24
|
-
subject: '
|
|
24
|
+
subject: I18n.t('lato.user_mailer.password_update_mail_subject'),
|
|
25
|
+
template_path: 'lato/mailer/user'
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def signin_success_mail(user_id, ip_address)
|
|
30
|
+
@user = Lato::User.find(user_id)
|
|
31
|
+
@ip_address = ip_address
|
|
32
|
+
|
|
33
|
+
set_user_locale
|
|
34
|
+
|
|
35
|
+
mail(
|
|
36
|
+
to: @user.email,
|
|
37
|
+
subject: I18n.t('lato.user_mailer.signin_success_mail_subject'),
|
|
25
38
|
template_path: 'lato/mailer/user'
|
|
26
39
|
)
|
|
27
40
|
end
|
data/app/models/lato/user.rb
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% if I18n.locale == 'en' %>
|
|
2
|
+
|
|
3
|
+
An access to your <b><%= Lato.config.application_title %></b> account has been made with the IP address <b><%= @ip_address %></b>.
|
|
4
|
+
<br><br>
|
|
5
|
+
If you have not made this access, we recommend you to change the password of your account and to contact the support.<br>
|
|
6
|
+
Otherwise, ignore this email.
|
|
7
|
+
|
|
8
|
+
<% else %>
|
|
9
|
+
|
|
10
|
+
E' stato effettuato un accesso al tuo account di <b><%= Lato.config.application_title %></b> con l'indirizzo IP <b><%= @ip_address %></b>.
|
|
11
|
+
<br><br>
|
|
12
|
+
Se non sei stato tu a effettuare l'accesso, ti consigliamo di cambiare la password del tuo account e di contattare il supporto.<br>
|
|
13
|
+
Altrimenti, ignora questa email.
|
|
14
|
+
|
|
15
|
+
<% end %>
|
data/config/locales/en.yml
CHANGED
|
@@ -60,6 +60,13 @@ en:
|
|
|
60
60
|
reset_password: Reset your password
|
|
61
61
|
per_page: Per page
|
|
62
62
|
|
|
63
|
+
invitation_mailer:
|
|
64
|
+
invite_mail_subject: You received an invitation
|
|
65
|
+
user_mailer:
|
|
66
|
+
email_verification_mail_subject: Confirm your email address
|
|
67
|
+
password_update_mail_subject: Set a new password
|
|
68
|
+
signin_success_mail_subject: New access to your account
|
|
69
|
+
|
|
63
70
|
account_controller:
|
|
64
71
|
update_user_action_notice: Account information properly updated
|
|
65
72
|
request_verify_email_action_notice: We have sent you an email with the steps to follow to complete the procedure
|
data/config/locales/it.yml
CHANGED
|
@@ -62,6 +62,13 @@ it:
|
|
|
62
62
|
reset_password: Reimposta la tua password
|
|
63
63
|
per_page: Per pagina
|
|
64
64
|
|
|
65
|
+
invitation_mailer:
|
|
66
|
+
invite_mail_subject: Hai ricevuto un invito
|
|
67
|
+
user_mailer:
|
|
68
|
+
email_verification_mail_subject: Conferma il tuo indirizzo email
|
|
69
|
+
password_update_mail_subject: Imposta una nuova password
|
|
70
|
+
signin_success_mail_subject: Nuovo accesso al tuo account
|
|
71
|
+
|
|
65
72
|
account_controller:
|
|
66
73
|
update_user_action_notice: Informazioni account aggiornate correttamente
|
|
67
74
|
request_verify_email_action_notice: Ti abbiamo inviato una email con i passaggi da seguire per completare la procedura
|
data/lib/lato/version.rb
CHANGED
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.
|
|
4
|
+
version: 3.10.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: 2024-
|
|
11
|
+
date: 2024-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -159,6 +159,7 @@ files:
|
|
|
159
159
|
- app/assets/javascripts/lato/controllers/lato_feedback_controller.js
|
|
160
160
|
- app/assets/javascripts/lato/controllers/lato_form_controller.js
|
|
161
161
|
- app/assets/javascripts/lato/controllers/lato_hello_controller.js
|
|
162
|
+
- app/assets/javascripts/lato/controllers/lato_input_autocomplete2_controller.js
|
|
162
163
|
- app/assets/javascripts/lato/controllers/lato_input_autocomplete_controller.js
|
|
163
164
|
- app/assets/javascripts/lato/controllers/lato_network_controller.js
|
|
164
165
|
- app/assets/javascripts/lato/controllers/lato_operation_controller.js
|
|
@@ -226,6 +227,7 @@ files:
|
|
|
226
227
|
- app/views/lato/mailer/invitation/invite_mail.html.erb
|
|
227
228
|
- app/views/lato/mailer/user/email_verification_mail.html.erb
|
|
228
229
|
- app/views/lato/mailer/user/password_update_mail.html.erb
|
|
230
|
+
- app/views/lato/mailer/user/signin_success_mail.html.erb
|
|
229
231
|
- app/views/lato/operations/show.html.erb
|
|
230
232
|
- app/views/layouts/lato/_action.html.erb
|
|
231
233
|
- app/views/layouts/lato/_aside-opener.html.erb
|
|
@@ -265,12 +267,12 @@ files:
|
|
|
265
267
|
- lib/lato/engine.rb
|
|
266
268
|
- lib/lato/version.rb
|
|
267
269
|
- lib/tasks/lato_tasks.rake
|
|
268
|
-
homepage: https://github.com/
|
|
270
|
+
homepage: https://github.com/Lato-org/lato
|
|
269
271
|
licenses:
|
|
270
272
|
- MIT
|
|
271
273
|
metadata:
|
|
272
|
-
homepage_uri: https://github.com/
|
|
273
|
-
source_code_uri: https://github.com/
|
|
274
|
+
homepage_uri: https://github.com/Lato-org/lato
|
|
275
|
+
source_code_uri: https://github.com/Lato-org/lato
|
|
274
276
|
post_install_message:
|
|
275
277
|
rdoc_options: []
|
|
276
278
|
require_paths:
|
|
@@ -286,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
286
288
|
- !ruby/object:Gem::Version
|
|
287
289
|
version: '0'
|
|
288
290
|
requirements: []
|
|
289
|
-
rubygems_version: 3.5.
|
|
291
|
+
rubygems_version: 3.5.15
|
|
290
292
|
signing_key:
|
|
291
293
|
specification_version: 4
|
|
292
294
|
summary: Basic engine for all Lato projects
|