Skip to content
Snippets Groups Projects
Commit 89979d50 authored by Jared Hancock's avatar Jared Hancock Committed by Peter Rotich
Browse files

queue: Implement column truncate option

parent 5ec10981
Branches
Tags
No related merge requests found
...@@ -725,8 +725,7 @@ extends VerySimpleModel { ...@@ -725,8 +725,7 @@ extends VerySimpleModel {
$text = $this->renderBasicValue($row); $text = $this->renderBasicValue($row);
// Truncate // Truncate
if ($class = $this->getTruncateClass()) { if ($text = $this->applyTruncate($text)) {
$text = sprintf('<span class="%s">%s</span>', $class, $text);
} }
// Filter // Filter
...@@ -766,15 +765,17 @@ extends VerySimpleModel { ...@@ -766,15 +765,17 @@ extends VerySimpleModel {
} }
} }
function getTruncateClass() { function applyTruncate($text) {
switch ($this->truncate) { switch ($this->truncate) {
case 'ellipsis': case 'ellipsis':
return 'trucate'; return sprintf('<span class="%s" style="max-width:%dpx">%s</span>',
'truncate', $this->width*1.1, $text);
case 'clip': case 'clip':
return 'truncate clip'; return sprintf('<span class="%s" style="max-width:%dpx">%s</span>',
'truncate clip', $this->width*1.1, $text);
default: default:
case 'wrap': case 'wrap':
return false; return $text;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment