feat: plugin readmore.js per header attività e altri usi

This commit is contained in:
FabioL 2024-11-14 17:46:47 +01:00
parent f6f4975825
commit ddca3f948a
6 changed files with 24 additions and 0 deletions

View File

@ -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 {

View File

@ -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: '<a href="#">' + globals.translations.readmore + '</a>',
lessLink: '<a href="#">' + globals.translations.readless + '</a>',
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){

View File

@ -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) {

View File

@ -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 '

View File

@ -172,9 +172,11 @@ echo '
<p><i class="fa '.(count($interventi_programmati) == 0 ? 'fa-clock-o text-success' : 'fa-clock-o text-warning').'"></i> '.(count($interventi_programmati) == 0 ? tr('Non sono presenti altre attività programmate') : 'Attività aperte:');
if (count($interventi_programmati) != 0) {
echo ' <div class="readmore" data-height="50">';
foreach ($interventi_programmati as $intervento_programmato) {
echo ' <a class="btn btn-default btn-xs" href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$intervento_programmato->id.'" target="_blank">'.$intervento_programmato->codice.' ('.(new Carbon($intervento_programmato->data_richiesta))->diffForHumans().')</a>';
}
echo ' </div>';
}
echo '
</p>';

View File

@ -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",