1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Show tooltip for long texts in datatable

This commit is contained in:
Hillel Coren 2018-01-25 11:42:58 +02:00
parent e936e9ccef
commit 52911841ff
6 changed files with 15 additions and 5 deletions

View File

@ -98,4 +98,14 @@ class EntityDatatable
return $str . '&nbsp; <span class="fa fa-file-o" data-toggle="tooltip" data-placement="bottom" title="' . e($note) . '"></span>';
}
public function showWithTooltip($str, $max = 60) {
$str = e($str);
if (strlen($str) > $max) {
return '<span data-toggle="tooltip" data-placement="bottom" title="' . $str . '">' . trim(substr($str, 0, $max)) . '...' . '</span>';
} else {
return $str;
}
}
}

View File

@ -85,7 +85,7 @@ class ExpenseDatatable extends EntityDatatable
[
'public_notes',
function ($model) {
return $model->public_notes != null ? e(substr($model->public_notes, 0, 100)) : '';
return $this->showWithTooltip($model->public_notes);
},
],
[

View File

@ -98,7 +98,7 @@ class RecurringExpenseDatatable extends EntityDatatable
[
'public_notes',
function ($model) {
return $model->public_notes != null ? substr($model->public_notes, 0, 100) : '';
return $this->showWithTooltip($model->public_notes, 100);
},
],
];

View File

@ -64,7 +64,7 @@ class RecurringInvoiceDatatable extends EntityDatatable
[
'private_notes',
function ($model) {
return e($model->private_notes);
return $this->showWithTooltip($model->private_notes);
},
],
[

View File

@ -20,7 +20,7 @@ class SubscriptionDatatable extends EntityDatatable
[
'target',
function ($model) {
return e(substr($model->target, 0, 40) . (strlen($model->target) > 40 ? '...' : ''));
return $this->showWithTooltip($model->target, 40);
},
],
];

View File

@ -59,7 +59,7 @@ class TaskDatatable extends EntityDatatable
[
'description',
function ($model) {
return e(substr($model->description, 0, 80) . (strlen($model->description) > 80 ? '...' : ''));
return $this->showWithTooltip($model->description);
},
],
[