summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Helper/Text.php4
-rw-r--r--app/Template/layout.php2
-rw-r--r--assets/css/app.css5
-rw-r--r--assets/css/src/header.css5
-rw-r--r--tests/units/TextHelperTest.php2
5 files changed, 13 insertions, 5 deletions
diff --git a/app/Helper/Text.php b/app/Helper/Text.php
index cfb557b1..790fc411 100644
--- a/app/Helper/Text.php
+++ b/app/Helper/Text.php
@@ -51,10 +51,10 @@ class Text extends \Core\Base
*/
public function truncate($value, $max_length = 85, $end = '[...]')
{
- $length = strlen($value);
+ $length = mb_strlen($value);
if ($length > $max_length) {
- return substr($value, 0, $max_length).' '.$end;
+ return mb_substr($value, 0, $max_length).' '.$end;
}
return $value;
diff --git a/app/Template/layout.php b/app/Template/layout.php
index 989afe18..0d9326f4 100644
--- a/app/Template/layout.php
+++ b/app/Template/layout.php
@@ -38,7 +38,7 @@
<?php else: ?>
<header>
<nav>
- <h1><?= $this->url->link('K<span>B</span>', 'app', 'index', array(), false, 'logo', t('Dashboard')).' '.$this->text->truncate($this->e($title)) ?>
+ <h1><?= $this->url->link('K<span>B</span>', 'app', 'index', array(), false, 'logo', t('Dashboard')).' '.$this->e($title) ?>
<?php if (! empty($description)): ?>
<span class="column-tooltip" title='<?= $this->e($this->text->markdown($description)) ?>'>
<i class="fa fa-info-circle"></i>
diff --git a/assets/css/app.css b/assets/css/app.css
index 73df92fc..f86f5051 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -653,13 +653,16 @@ div.ui-tooltip {
header {
margin-top: 10px;
padding-bottom: 15px;
- clear: both;
border-bottom: 1px solid #dedede;
}
header h1 {
margin: 0;
padding: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ width: 75%;
float: left;
}
diff --git a/assets/css/src/header.css b/assets/css/src/header.css
index 2490b125..bcb9dcd7 100644
--- a/assets/css/src/header.css
+++ b/assets/css/src/header.css
@@ -2,13 +2,16 @@
header {
margin-top: 10px;
padding-bottom: 15px;
- clear: both;
border-bottom: 1px solid #dedede;
}
header h1 {
margin: 0;
padding: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ width: 75%;
float: left;
}
diff --git a/tests/units/TextHelperTest.php b/tests/units/TextHelperTest.php
index 20b89fa8..01652d5c 100644
--- a/tests/units/TextHelperTest.php
+++ b/tests/units/TextHelperTest.php
@@ -45,6 +45,8 @@ class TextHelperTest extends Base
$this->assertEquals('abc', $h->truncate('abc'));
$this->assertEquals(str_repeat('a', 85).' [...]', $h->truncate(str_repeat('a', 200)));
+
+ $this->assertEquals('Настольная рекл [...]', $h->truncate('Настольная реклама в фудкорте ГЧ', 15));
}
public function testContains()