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

queue: Fix install on clusters, add left-clip truncate

The lclip truncate method allows for trimming the beginnging of the text.
This trimming will only work properly for left-to-right languages because it
changes the CSS `direction` property. Writing a rtl language ltr will
probably not be legible.
parent 0184feb1
No related branches found
No related tags found
No related merge requests found
......@@ -384,6 +384,10 @@ class Internationalization {
return self::getDefaultLanguage();
}
static function getCurrentLanguageInfo($user=false) {
return static::getLanguageInfo(static::getCurrentLanguage($user));
}
static function getCurrentLocale($user=false) {
global $thisstaff, $cfg;
......
......@@ -848,13 +848,17 @@ extends VerySimpleModel {
$offset += $a->getWidth($row);
$width = $this->width - $offset;
$class = array();
switch ($this->truncate) {
case 'ellipsis':
return sprintf('<span class="%s" style="max-width:%dpx">%s</span>',
'truncate', $width, $text);
case 'lclip':
$linfo = Internationalization::getCurrentLanguageInfo();
$class[] = $linfo['direction'] == 'rtl' ? 'ltr' : 'rtl';
case 'clip':
$class[] = 'bleed';
case 'ellipsis':
$class[] = 'truncate';
return sprintf('<span class="%s" style="max-width:%dpx">%s</span>',
'truncate bleed', $width, $text);
implode(' ', $class), $width, $text);
default:
case 'wrap':
return $text;
......@@ -1019,15 +1023,6 @@ extends VerySimpleModel {
$this->annotations = JsonDataEncoder::encode($annotations);
$this->conditions = JsonDataEncoder::encode($conditions);
}
function save($refetch=false) {
if ($this->__new__ && isset($this->id))
// The ID is used to synchrize the POST data with the forms API.
// It should not be assumed to be a valid or unique database ID
// number
unset($this->id);
return parent::save($refetch);
}
}
class QueueColumnGlue
......@@ -1242,6 +1237,7 @@ extends AbstractForm {
'wrap' => __("Wrap Lines"),
'ellipsis' => __("Add Ellipsis"),
'clip' => __("Clip Text"),
'lclip' => __("Clip Beginning Text"),
),
'default' => 'wrap',
'layout' => new GridFluidCell(4),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment