Skip to content

Commit 6093f42

Browse files
committed
Libdoc: Show shortcut/tag list style widget with more than one items.
Fixes robotframework#3635 (again).
1 parent 895eac5 commit 6093f42

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/robot/htmldata/libdoc/libdoc.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ <h1>Opening library documentation failed</h1>
4646
renderTemplate('importing', libdoc);
4747
}
4848
renderTemplate('shortcuts', libdoc);
49-
initShortcutListStyle('shortcut');
49+
initShortcutListStyle('shortcut', libdoc.keywords);
5050
if (libdoc.contains_tags) {
5151
renderTemplate('tags', libdoc);
52-
initShortcutListStyle('tag');
52+
initShortcutListStyle('tag', libdoc.all_tags);
5353
}
5454
renderTemplate('keywords', libdoc);
5555
renderTemplate('footer', libdoc);
@@ -85,8 +85,9 @@ <h1>Opening library documentation failed</h1>
8585
$('.shortcuts a').width('max-content');
8686
}
8787

88-
function initShortcutListStyle(name) {
89-
if (storage.get(name + '-list-style', 'compact') != 'compact') {
88+
function initShortcutListStyle(name, items) {
89+
var style = storage.get(name + '-list-style', 'compact');
90+
if (style != 'compact' && items.length > 1) {
9091
$('.' + name + '-list-separator').html('<br>');
9192
$('.' + name + '-list-toggle .switch').prop('checked', true);
9293
}
@@ -336,7 +337,7 @@ <h2 id="Importing">Importing</h2>
336337

337338
<script type="text/x-jquery-tmpl" id="shortcuts-template">
338339
<h2 id="Shortcuts">Shortcuts</h2>
339-
{{if keywords.length > 3}}
340+
{{if keywords.length > 1}}
340341
<div class="shortcut-list-toggle">
341342
<b>List style:</b>&nbsp; Compact
342343
<label title="Switch between compact list and expanded list">
@@ -360,7 +361,7 @@ <h2 id="Shortcuts">Shortcuts</h2>
360361

361362
<script type="text/x-jquery-tmpl" id="tags-template">
362363
<h2 id="Tags">Tags</h2>
363-
{{if all_tags.length > 3}}
364+
{{if all_tags.length > 1}}
364365
<div class="tag-list-toggle">
365366
<b>List style:</b>&nbsp; Compact
366367
<label title="Switch between compact list and expanded list">

0 commit comments

Comments
 (0)