diff --git a/app/Ninja/Datatables/EntityDatatable.php b/app/Ninja/Datatables/EntityDatatable.php
index 02fd80845756..08e55549e959 100644
--- a/app/Ninja/Datatables/EntityDatatable.php
+++ b/app/Ninja/Datatables/EntityDatatable.php
@@ -98,4 +98,14 @@ class EntityDatatable
return $str . ' ';
}
+
+ public function showWithTooltip($str, $max = 60) {
+ $str = e($str);
+
+ if (strlen($str) > $max) {
+ return '' . trim(substr($str, 0, $max)) . '...' . '';
+ } else {
+ return $str;
+ }
+ }
}
diff --git a/app/Ninja/Datatables/ExpenseDatatable.php b/app/Ninja/Datatables/ExpenseDatatable.php
index 45e277e15455..800bc56f7eb5 100644
--- a/app/Ninja/Datatables/ExpenseDatatable.php
+++ b/app/Ninja/Datatables/ExpenseDatatable.php
@@ -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);
},
],
[
diff --git a/app/Ninja/Datatables/RecurringExpenseDatatable.php b/app/Ninja/Datatables/RecurringExpenseDatatable.php
index 3117e1cec558..78a6fdb7df8c 100644
--- a/app/Ninja/Datatables/RecurringExpenseDatatable.php
+++ b/app/Ninja/Datatables/RecurringExpenseDatatable.php
@@ -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);
},
],
];
diff --git a/app/Ninja/Datatables/RecurringInvoiceDatatable.php b/app/Ninja/Datatables/RecurringInvoiceDatatable.php
index df434b11902f..2f4555da7ee5 100644
--- a/app/Ninja/Datatables/RecurringInvoiceDatatable.php
+++ b/app/Ninja/Datatables/RecurringInvoiceDatatable.php
@@ -64,7 +64,7 @@ class RecurringInvoiceDatatable extends EntityDatatable
[
'private_notes',
function ($model) {
- return e($model->private_notes);
+ return $this->showWithTooltip($model->private_notes);
},
],
[
diff --git a/app/Ninja/Datatables/SubscriptionDatatable.php b/app/Ninja/Datatables/SubscriptionDatatable.php
index d83d9a501fe2..c07cac012332 100644
--- a/app/Ninja/Datatables/SubscriptionDatatable.php
+++ b/app/Ninja/Datatables/SubscriptionDatatable.php
@@ -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);
},
],
];
diff --git a/app/Ninja/Datatables/TaskDatatable.php b/app/Ninja/Datatables/TaskDatatable.php
index e019c899b1bf..c4a5814afd44 100644
--- a/app/Ninja/Datatables/TaskDatatable.php
+++ b/app/Ninja/Datatables/TaskDatatable.php
@@ -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);
},
],
[