From 89979d502a48548a258def2a1479fd7af2b6852c Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 7 Oct 2015 10:54:03 -0400 Subject: [PATCH] queue: Implement column truncate option --- include/class.queue.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/class.queue.php b/include/class.queue.php index c17e8e91e..07b4a1902 100644 --- a/include/class.queue.php +++ b/include/class.queue.php @@ -725,8 +725,7 @@ extends VerySimpleModel { $text = $this->renderBasicValue($row); // Truncate - if ($class = $this->getTruncateClass()) { - $text = sprintf('<span class="%s">%s</span>', $class, $text); + if ($text = $this->applyTruncate($text)) { } // Filter @@ -766,15 +765,17 @@ extends VerySimpleModel { } } - function getTruncateClass() { + function applyTruncate($text) { switch ($this->truncate) { case 'ellipsis': - return 'trucate'; + return sprintf('<span class="%s" style="max-width:%dpx">%s</span>', + 'truncate', $this->width*1.1, $text); case 'clip': - return 'truncate clip'; + return sprintf('<span class="%s" style="max-width:%dpx">%s</span>', + 'truncate clip', $this->width*1.1, $text); default: case 'wrap': - return false; + return $text; } } -- GitLab