Skip to content

Commit

Permalink
Fixed issue #18639: Token browse can be unusable with lot of data in …
Browse files Browse the repository at this point in the history
…some attribute (#3081)

Dev: longtext formatter + css
  • Loading branch information
Shnoulle committed Apr 27, 2023
1 parent d64b419 commit ed168a0
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 253 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -16,5 +16,5 @@
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
$config['assetsversionnumber'] = '30331';
$config['assetsversionnumber'] = '30332';
return $config;
38 changes: 22 additions & 16 deletions application/extensions/CustomFormatter.php
@@ -1,10 +1,14 @@
<?php

// Build the expanded list of languages
/**
* @inheritdoc
*/
class CustomFormatter extends CFormatter {

public $maxLength = 125;
/* @var integer longTextMaxLength */
public $longTextMaxLength = 125;

// Build the expanded list of languages
public function formatLanguageList($value) {

$langArr = explode(' ', trim($value));
Expand All @@ -19,18 +23,20 @@ public function formatLanguageList($value) {
return implode(', ', $expandedArr);
}

/**
* return a string limited by $this->maxLength
* @param $value
* @deprecated in 3.6.2
* @return $string
*/
public function formatLongText($value) {
$value = CHtml::encode($value);
if(strlen($value) > $this->maxLength) {
$truncated = substr($value, 0, $this->maxLength-3);
return trim($truncated)."...";
}
return $value;
}
/**
* return a string limited by $this->maxLength
* @param string|null $value
* @return $string
*/
public function formatLongText($value) {
if (empty($value)) {
return $value;
}
$originalvalue = $value = CHTML::encode($value);
if (mb_strlen($value, 'UTF-8') > $this->longTextMaxLength) {
$value = ellipsize($value, $this->longTextMaxLength);
}
$value = '<span class="longtext-content" data-toggle="tooltip" data-placement="left" title="' . $originalvalue . '">' . $value . '</span>';
return $value;
}
}
1 change: 1 addition & 0 deletions application/models/TokenDynamic.php
Expand Up @@ -766,6 +766,7 @@ public function getAttributesForGrid()
$aCustomAttributesCols[] = array(
'header' => $desc . $this->setEncryptedAttributeLabel(self::$sid, 'Token', $sColName), // $aAttributedescriptions->$sColName->description,
'name' => $sColName,
'type' => 'longtext',
'value' => '$data->' . $sColName,
'headerHtmlOptions' => array('class' => 'hidden-xs'),
'htmlOptions' => array('class' => 'hidden-xs'),
Expand Down
244 changes: 127 additions & 117 deletions assets/packages/adminbasics/build/adminbasics.css
@@ -1,4 +1,111 @@
@charset "UTF-8";
.draggable-container {
min-height: 300px;
}

#newcreated,
#tokenattribute,
#csvattribute,
#centralattribute {
margin-left: 0.75%;
margin-right: 0.75%;
margin-bottom: 20px;
}

#tokenattribute {
margin-left: 1.5%;
}

#centralattribute {
margin-right: 1.5%;
}

#centralattribute .centralatt {
padding-bottom: 15px;
}

#newcreated .attribute-item input {
display: block;
margin: 2px auto;
width: 80%;
}

#centralattribute div.centralatt div.token-attribute {
margin-top: -5px;
min-height: 20px;
}

#newcreated,
#tokenattribute {
height: 100%;
}

.heading {
height: auto;
padding-top: 7px;
font-weight: bold;
}

div.mappable-attribute-wrapper {
width: 80%;
margin: 6px auto;
padding: 6px;
}

div.attribute-item, .already-mapped-attribute {
width: 80%;
margin: 6px auto;
padding: 4px;
text-align: center;
}

#centralattribute .explanation {
width: 90%;
margin: 0 auto;
text-align: left;
}

#centralattribute .explanation-row {
display: table-row;
}

#centralattribute .explanation input,
#centralattribute .explanation label {
display: table-cell;
padding-top: 4px;
padding-bottom: 4px;
}

#centralattribute .explanation label {
padding-left: 8px;
}

.attribute-item.draggable {
cursor: move;
}

div.mappable-attribute-wrapper.target-hover {
padding-bottom: 27px;
}

div.mappable-attribute-wrapper.paired.target-hover {
padding-bottom: 4px;
}

div.mappable-attribute-wrapper.paired.ui-state-disabled {
opacity: 1;
filter: alpha(opacity=100);
}

.draggable-container .attribute-column .ui-draggable-dragging {
z-index: 100;
}

/* Existing attribute column in CSV CPDB import */
.centralatt {
min-height: 100px;
}

.jcarousel-wrapper {
margin: 20px auto;
position: relative;
Expand Down Expand Up @@ -120,113 +227,6 @@
min-height: 100px;
}

.draggable-container {
min-height: 300px;
}

#newcreated,
#tokenattribute,
#csvattribute,
#centralattribute {
margin-left: 0.75%;
margin-right: 0.75%;
margin-bottom: 20px;
}

#tokenattribute {
margin-left: 1.5%;
}

#centralattribute {
margin-right: 1.5%;
}

#centralattribute .centralatt {
padding-bottom: 15px;
}

#newcreated .attribute-item input {
display: block;
margin: 2px auto;
width: 80%;
}

#centralattribute div.centralatt div.token-attribute {
margin-top: -5px;
min-height: 20px;
}

#newcreated,
#tokenattribute {
height: 100%;
}

.heading {
height: auto;
padding-top: 7px;
font-weight: bold;
}

div.mappable-attribute-wrapper {
width: 80%;
margin: 6px auto;
padding: 6px;
}

div.attribute-item, .already-mapped-attribute {
width: 80%;
margin: 6px auto;
padding: 4px;
text-align: center;
}

#centralattribute .explanation {
width: 90%;
margin: 0 auto;
text-align: left;
}

#centralattribute .explanation-row {
display: table-row;
}

#centralattribute .explanation input,
#centralattribute .explanation label {
display: table-cell;
padding-top: 4px;
padding-bottom: 4px;
}

#centralattribute .explanation label {
padding-left: 8px;
}

.attribute-item.draggable {
cursor: move;
}

div.mappable-attribute-wrapper.target-hover {
padding-bottom: 27px;
}

div.mappable-attribute-wrapper.paired.target-hover {
padding-bottom: 4px;
}

div.mappable-attribute-wrapper.paired.ui-state-disabled {
opacity: 1;
filter: alpha(opacity=100);
}

.draggable-container .attribute-column .ui-draggable-dragging {
z-index: 100;
}

/* Existing attribute column in CSV CPDB import */
.centralatt {
min-height: 100px;
}

#selectable .ui-selecting {
background: #8CCE00;
}
Expand Down Expand Up @@ -4649,6 +4649,16 @@ html[dir=rtl] th {
display: none;
}

.translate > table {
table-layout: fixed;
}

.translate td._from_ > .question-text-from {
width: 100%;
overflow: auto;
word-wrap: break-word;
}

#responses-column-filter-modal .checkbox label {
vertical-align: text-bottom;
white-space: nowrap;
Expand All @@ -4665,16 +4675,6 @@ html[dir=rtl] th {
padding-bottom: 15px;
}

.translate > table {
table-layout: fixed;
}

.translate td._from_ > .question-text-from {
width: 100%;
overflow: auto;
word-wrap: break-word;
}

.grid-view .table td.button-column, .grid-view .table th.button-column, .grid-view-ls .table td.button-column, .grid-view-ls .table th.button-column {
white-space: nowrap;
text-align: initial;
Expand Down Expand Up @@ -4718,6 +4718,16 @@ html[dir=rtl] th {
display: none;
}

.grid-view-ls .table td .longtext-content {
min-width: 8em;
max-width: 16em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 1.5em;
display: inline-block;
}

.dropdown-menu.larger-dropdown {
min-width: 240px;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/packages/adminbasics/build/adminbasics.min.css

Large diffs are not rendered by default.

0 comments on commit ed168a0

Please sign in to comment.