Skip to content

Commit a036257

Browse files
committed
fix: avviso per valore richiesto al login
1 parent 400de11 commit a036257

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

assets/src/css/style.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,28 @@ input.small-width {
16601660
color: red;
16611661
}
16621662

1663+
/* Contenitore per gli errori di Parsley.js */
1664+
.parsley-errors-container {
1665+
margin-top: 0.25rem;
1666+
margin-bottom: 1rem;
1667+
}
1668+
1669+
/* Stili per allineare l'avviso di Parsley.js con quello delle credenziali non valide */
1670+
.login-box .parsley-error-message {
1671+
display: block;
1672+
width: 100%;
1673+
margin-top: 0.25rem;
1674+
font-size: 0.875rem;
1675+
color: #dc3545;
1676+
}
1677+
1678+
.login-box .parsley-error-message:before {
1679+
content: "\f06a";
1680+
font-family: "FontAwesome";
1681+
margin-right: 0.25rem;
1682+
display: inline-block;
1683+
}
1684+
16631685

16641686
/** TIMELINE */
16651687

assets/src/js/functions/init.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,29 @@ function init() {
2727
initTooltips();
2828

2929
if ($('form').length) {
30-
$('form').not('.no-check').parsley();
30+
// Configurazione per posizionare correttamente i messaggi di errore di Parsley.js
31+
$('form').not('.no-check').parsley({
32+
errorsContainer: function(parsleyField) {
33+
// Per i campi dentro input-group, crea un contenitore dopo l'input-group
34+
var $inputGroup = parsleyField.$element.closest('.input-group');
35+
if ($inputGroup.length) {
36+
var containerId = 'parsley-errors-' + parsleyField.$element.attr('name');
37+
var $container = $('#' + containerId);
38+
39+
// Se il contenitore non esiste, crealo dopo l'input-group
40+
if (!$container.length) {
41+
$container = $('<div id="' + containerId + '" class="parsley-errors-container"></div>');
42+
$inputGroup.after($container);
43+
}
44+
45+
return $container;
46+
}
47+
// Altrimenti usa il comportamento predefinito
48+
return parsleyField.$element.parent();
49+
},
50+
errorsWrapper: '<div class="parsley-errors-list"></div>',
51+
errorTemplate: '<div class="parsley-error-message"></div>'
52+
});
3153

3254
if (window.CKEDITOR){
3355
CKEDITOR.on('instanceReady', function () {
@@ -75,6 +97,14 @@ function init() {
7597
this.$element.removeClass('parsley-success');
7698
});
7799

100+
// Ripristina il pulsante di login quando la validazione fallisce
101+
window.Parsley.on('field:error', function() {
102+
var $loginButton = $('#login-button');
103+
if ($loginButton.length && $loginButton.html().indexOf('Autenticazione') !== -1) {
104+
$loginButton.html('<i class="fa fa-sign-in mr-2"></i> Accedi');
105+
}
106+
});
107+
78108
restart_inputs();
79109
}
80110

0 commit comments

Comments
 (0)