Fix visualizzazione note in righe

This commit is contained in:
Pek5892 2023-10-06 17:06:44 +02:00
parent ab6c0f11c5
commit d733a1db4a
2 changed files with 32 additions and 4 deletions

View File

@ -1225,4 +1225,16 @@ kbd{
padding: 6px 8px;
display: inline-block;
margin: 1px;
}
}
.read-more-target {
display: none;
}
.read-more-trigger {
cursor: pointer;
}
.read-more-target:target {
display: block;
}

View File

@ -58,7 +58,6 @@ echo '
$num = 0;
foreach ($righe as $riga) {
++$num;
$extra = '';
$mancanti = 0;
$delete = 'delete_riga';
@ -176,8 +175,25 @@ foreach ($righe as $riga) {
}
if (!empty($riga->note)) {
echo '
<br><small class="label label-default">'.nl2br($riga->note).'</small>';
if(strlen($riga->note) > 50) {
$prima_parte = substr($riga->note, 0, ((strpos($riga->note, ' ', 50) < 60) && (strpos($riga->note, ' ', 50) != 0) ? strpos($riga->note, ' ', 50): 50));
$seconda_parte = substr($riga->note, ((strpos($riga->note, ' ', 50) < 60) && (strpos($riga->note, ' ', 50) != 0) ? strpos($riga->note, ' ', 50): 50));
$stringa_modificata = '<small class="label label-default">'.$prima_parte.'</small>
<span id="read-more-target-'.$riga->id.'" class="read-more-target"><small class="label label-default">' . $seconda_parte . '</small></span><a href="#read-more-target-'.$riga->id.'" class="read-more-trigger">...</a>';
} else {
$stringa_modificata = '<small class="label label-default">'.$riga->note.'</small>';
}
echo'
<div class="block-item-text">
<input type="checkbox" hidden class="read-more-state" id="read-more">
<div class="read-more-wrap">
'.nl2br($stringa_modificata).'
</div>
</div>
';
}
echo '
</td>';