diff options
author | Victor S <32728904+ulcuber@users.noreply.github.com> | 2022-06-23 10:48:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-23 10:48:50 +0300 |
commit | a43f2e58a79498bfb099d54d6a4d815251db1185 (patch) | |
tree | 8e1cecb22023b30cd0918fc14c870699ca642b76 /plugins/API | |
parent | 3fcac56c05ce1c87df5ac16edd6408a2d1b92187 (diff) |
Fixes glossary navigation (#19387)
* fixed: multibyte langs glossary navigation
* fixed: scrollspy effects visibility in glossary
* fixed: mb_ereg_replace does not require separators
Diffstat (limited to 'plugins/API')
-rw-r--r-- | plugins/API/Controller.php | 10 | ||||
-rw-r--r-- | plugins/API/stylesheets/glossary.less | 14 | ||||
-rw-r--r-- | plugins/API/templates/glossary.twig | 4 |
3 files changed, 18 insertions, 10 deletions
diff --git a/plugins/API/Controller.php b/plugins/API/Controller.php index e73cc6a37f..20679ecadc 100644 --- a/plugins/API/Controller.php +++ b/plugins/API/Controller.php @@ -193,13 +193,11 @@ class Controller extends \Piwik\Plugin\Controller foreach ($glossaryItems as &$item) { $item['letters'] = array(); foreach ($item['entries'] as &$entry) { - $cleanEntryName = preg_replace('/["\']/', '', $entry['name']); - $entry['letter'] = mb_strtoupper(substr($cleanEntryName, 0, 1)); - $item['letters'][] = $entry['letter']; + $cleanEntryName = mb_ereg_replace('["\']', '', $entry['name']); + $letter = mb_strtoupper(mb_substr($cleanEntryName, 0, 1)); + $entry['letter'] = $letter; + $item['letters'][$letter] = $letter; } - - $item['letters'] = array_unique($item['letters']); - sort($item['letters']); } return $this->renderTemplate('glossary', array( diff --git a/plugins/API/stylesheets/glossary.less b/plugins/API/stylesheets/glossary.less index 9b275867bc..be8b418f3d 100644 --- a/plugins/API/stylesheets/glossary.less +++ b/plugins/API/stylesheets/glossary.less @@ -1,5 +1,5 @@ -.glossary .table-of-contents a { +.glossary .pagination a { box-sizing: content-box; padding: 0 10px 5px; &:hover, &.active { @@ -8,4 +8,14 @@ border-left: none; border-bottom: 2px solid @color-blue-piwik; } -}
\ No newline at end of file +} + +.glossary .pagination li { + // a {line-height: 30px + padding: 5px} + // vs standard .pagination li {height: 30px} + height: 35px; +} + +.glossary .scrollspy { + padding-top: 2rem; +} diff --git a/plugins/API/templates/glossary.twig b/plugins/API/templates/glossary.twig index 3138c195f6..0b7e471cfd 100644 --- a/plugins/API/templates/glossary.twig +++ b/plugins/API/templates/glossary.twig @@ -28,7 +28,7 @@ <div class="card-content"> <div style="background:#fff;width:100%" class="pushpin"> <h2 class="card-title">{{ item.title }}</h2> - <ul class="pagination table-of-contents"> + <ul class="pagination"> {% for letter in item.letters %} <li class="waves-effect"><a href="#{{ keyword }}{{ letter }}">{{ letter }}</a></li> {% endfor %} @@ -39,7 +39,7 @@ {% if not lastLetter or lastLetter != entry.letter %} {% if lastLetter %}</div>{% endif %} {% set lastLetter = entry.letter %} - <div class="section scrollspy" id="{{ keyword }}{{ lastLetter }}"> + <div class="scrollspy" id="{{ keyword }}{{ lastLetter }}"> {% endif %} <h3 style="color:#4183C4;font-weight: bold;">{{ entry.name }}</h3> {% if entry.subtitle|default is not empty %}<p style="color:#999;text-transform:uppercase;font-weight:normal;margin-top:-16px;">{{ entry.subtitle|translate }}</p>{% endif %} |