From 968777360cadf8c918850ab8278472fa7fbec924 Mon Sep 17 00:00:00 2001 From: Alexander Purr <purr@ub.uni-leipzig.de> Date: Wed, 9 Sep 2020 15:25:08 +0200 Subject: [PATCH] refs #18132 [finc] toggle additional information on item detail instead showing tooltip * template for nested lists using recursion * adding styles for highlight toggle action --- themes/finc/scss/compiled.scss | 31 +++++++++++++++++++ .../finc/templates/Helpers/nestedList.phtml | 8 +++++ .../DefaultRecord/data-rvkNotation.phtml | 26 ++++++++-------- 3 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 themes/finc/templates/Helpers/nestedList.phtml diff --git a/themes/finc/scss/compiled.scss b/themes/finc/scss/compiled.scss index a4ce7deba76..0323215212f 100644 --- a/themes/finc/scss/compiled.scss +++ b/themes/finc/scss/compiled.scss @@ -582,6 +582,37 @@ select { // display: block; //} +//// Record View Toggler - show extended information on single item +a.toggle { + color: inherit; + text-decoration: inherit; + &:active, + &:focus, + &:hover { + text-decoration: inherit; + } + &::after { + font-family: 'FontAwesome'; + content: $fa-var-angle-down; + padding-left: 2px; + } +} + +span.notation ul { + padding-inline-start: 1.5em; + @media (max-width: $screen-md-min) { + padding-inline-start: 0; + } + li { + list-style-type: none; + } + li:before { + margin-right: 0.5em; + font-family: 'FontAwesome'; + content: $fa-var-level-down; + } +} + //// ALERTS ////// Light Text on Dark BG .alert { diff --git a/themes/finc/templates/Helpers/nestedList.phtml b/themes/finc/templates/Helpers/nestedList.phtml new file mode 100644 index 00000000000..acba95440d9 --- /dev/null +++ b/themes/finc/templates/Helpers/nestedList.phtml @@ -0,0 +1,8 @@ +<?php //Base case: an empty array produces no list ?> +<?php if (!empty($array)): ?> + <ul> + <li><?=array_shift($array)?></li> + <?php //Recursive Step: make a list with child lists ?> + <?= $this->render('Helpers/nestedList.phtml', ['array' => $array])?> + </ul> +<?php endif; ?> \ No newline at end of file diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-rvkNotation.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-rvkNotation.phtml index ace98595279..59cc4551a62 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/data-rvkNotation.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/data-rvkNotation.phtml @@ -2,25 +2,25 @@ <?php /* partial copied from themes/finc/templates/RecordTab/topics.phtml */ ?> <?php $i = 0; foreach ($data as $item): ?> <?=($i>0?"<br />":"") //no linebreak after last item ?> - <?php if (isset($item['level']) ): ?> - <?php - $tooltip_content = "<ul class='no-bullet'>"; - if (isset($item['level']) && count($item['level'])) { - foreach ($item['level'] as $level) { - $tooltip_content .= "<li>" . $level . "</li>"; - } - } - $tooltip_content .= "</ul>"; - ?> - <?php endif; ?> - <span <?=(isset($tooltip_content) ? 'data-toggle="tooltip" data-html="true" title="' . $tooltip_content . '"' : "")?>> + + <span> <a href="<?=$this->record($this->driver)->getLink('rvk', $item['rvk'])?>"> <?=$item['rvk']?> </a> </span> + <?php if(isset($item['name'])): ?> - <span><?=$item['name']?></span> + <a class="toggle" role="button" data-toggle="collapse" href="#collapse_rvk_<?=$i?>" aria-expanded="false" aria-controls="collapse_rvk_<?=$i?>"> + <?=$item['name']?> + </a> + <?php endif; ?> + + <?php if(isset($item['level']) && is_array($item['level'])): ?> + <span id="collapse_rvk_<?=$i?>" class="collapse notation"> + <?= $this->render('Helpers/nestedList.phtml', ['array' => $item['level']]); ?> + </span> <?php endif; ?> + <?php $i++; ?> <?php endforeach; ?> <!-- finc: RecordDriver - DefaultRecord - data-rvkNotation - END --> \ No newline at end of file -- GitLab