diff --git a/assets/src/css/style.css b/assets/src/css/style.css index 6cb3e9fc3..582a9a2a1 100755 --- a/assets/src/css/style.css +++ b/assets/src/css/style.css @@ -1658,6 +1658,9 @@ body:not(.sidebar-collapse) .sidebar .nav-treeview .nav-treeview .nav-link { list-style: none; } +.readmore{ + overflow: hidden; +} @media screen and (max-width: 767px) { .navbar-left { diff --git a/assets/src/js/base/custom.js b/assets/src/js/base/custom.js index 986db2896..1a8d0fd89 100644 --- a/assets/src/js/base/custom.js +++ b/assets/src/js/base/custom.js @@ -98,6 +98,18 @@ $(document).ready(function () { }); }, 1000); + // Plugin readmore.js + $('.readmore').each( function(){ + height = $(this).data('height') ? parseInt($(this).data('height')) : 50; + + $(this).readmore({ + collapsedHeight: height, + moreLink: '' + globals.translations.readmore + '', + lessLink: '' + globals.translations.readless + '', + beforeToggle: function(){ setTimeout( 'alignMaxHeight(".module-header .card");', 300 ); }, + }); + }); + alignMaxHeight(".module-header .card"); $("#main_loading").fadeOut() @@ -130,6 +142,9 @@ function sendWhatsAppMessage(phoneNumber, message) { } function alignMaxHeight(element){ + // Azzera l'altezza fissa + $(element).css('height', 'auto'); + max_height = 0; $(element).each( function(){ if($(this).height() > max_height){ diff --git a/gulpfile.js b/gulpfile.js index 4d74e7058..e3020a593 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -127,6 +127,7 @@ const JS = gulp.parallel(() => { 'leaflet.fullscreen/Control.FullScreen.js', 'ismobilejs/dist/isMobile.min.js', 'ua-parser-js/dist/ua-parser.min.js', + 'readmore.js/readmore.js', ]; for (const i in vendor) { diff --git a/include/top.php b/include/top.php index be6aacb9d..21e04534a 100755 --- a/include/top.php +++ b/include/top.php @@ -124,6 +124,8 @@ if (Auth::check()) { 'singleCalendar' => tr("E' presente un solo periodo."), 'noResults' => tr('Nessun elemento trovato'), 'signatureMissing' => tr('Firma mancante.'), + 'readmore' => tr('Mostra tutto'), + 'readless' => tr('Mostra meno'), ]; foreach ($translations as $key => $value) { echo ' diff --git a/modules/interventi/header.php b/modules/interventi/header.php index 394e256b9..0d3e85c3a 100644 --- a/modules/interventi/header.php +++ b/modules/interventi/header.php @@ -172,9 +172,11 @@ echo '

'.(count($interventi_programmati) == 0 ? tr('Non sono presenti altre attività programmate') : 'Attività aperte:'); if (count($interventi_programmati) != 0) { + echo '

'; foreach ($interventi_programmati as $intervento_programmato) { echo ' '.$intervento_programmato->codice.' ('.(new Carbon($intervento_programmato->data_richiesta))->diffForHumans().')'; } + echo '
'; } echo '

'; diff --git a/package.json b/package.json index 7f448a9bd..5d25102bf 100755 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "pdfjs-viewer-element": "2.5.4", "popper.js": "^1.16.1", "pwstrength-bootstrap": "^3.0.4", + "readmore.js": "^2.0.4", "select2": "^4.0.3", "signature_pad": "^2.3.0", "smartwizard": "^4.2.2",