Skip to content

Commit 86d348d

Browse files
committed
Auto merge of #12656 - SpencerAWill:Add-expand-all-to-the-web-site, r=xFrednet
Add 'Expand All' & 'Collapse All' to the website changelog: Add 'Expand All' and 'Collapse All' buttons to the website. Fixes #12542 Desktop view: ![image](https://github.com/rust-lang/rust-clippy/assets/43732866/554d7782-352c-4705-83f0-1cbc809a3290) Mobile view: ![image](https://github.com/rust-lang/rust-clippy/assets/43732866/2845fc9a-a9e8-4057-b7dd-a8a1dbf47290) I did have some slight performance issues with lots of tabs being open. In the future it may be worth it to consider virtual scrolling. I'm not sure if this would allow ctrl+f finding on all the lints since the DOM won't contain the text of all the lints, just those that need to be immediately shown.
2 parents b794b8e + 6ae5fd9 commit 86d348d

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

util/gh-pages/index.html

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,17 @@
5757
background-color: var(--theme-hover);
5858
}
5959

60-
div.panel div.panel-body button.dropdown-toggle {
60+
div.panel div.panel-body button {
6161
background: var(--searchbar-bg);
6262
color: var(--searchbar-fg);
6363
border-color: var(--theme-popup-border);
6464
}
6565

66-
div.panel div.panel-body button.dropdown-toggle:hover {
66+
div.panel div.panel-body button:hover {
6767
box-shadow: 0 0 3px var(--searchbar-shadow-color);
6868
}
6969

70-
div.panel div.panel-body .open button.dropdown-toggle {
71-
background: var(--searchbar-bg);
72-
color: var(--searchbar-fg);
73-
border-color: var(--theme-popup-border);
70+
div.panel div.panel-body button.open {
7471
filter: brightness(90%);
7572
}
7673

@@ -96,7 +93,6 @@
9693
@media (min-width: 992px) {
9794
.search-control {
9895
margin-top: 0;
99-
float: right;
10096
}
10197
}
10298

@@ -361,6 +357,24 @@
361357
opacity: 30%;
362358
}
363359

360+
.expansion-group {
361+
margin-top: 15px;
362+
padding: 0px 8px;
363+
display: flex;
364+
flex-wrap: nowrap;
365+
}
366+
367+
@media (min-width: 992px) {
368+
.expansion-group {
369+
margin-top: 0;
370+
padding: 0px 15px;
371+
}
372+
}
373+
374+
.expansion-control {
375+
width: 50%;
376+
}
377+
364378
:not(pre) > code {
365379
color: var(--inline-code-color);
366380
background-color: var(--inline-code-bg);
@@ -405,7 +419,7 @@ <h1>Clippy Lints</h1>
405419

406420
<div class="panel panel-default" ng-show="data">
407421
<div class="panel-body row">
408-
<div id="upper-filters" class="col-12 col-md-6">
422+
<div id="upper-filters" class="col-12 col-md-5">
409423
<div class="btn-group" filter-dropdown>
410424
<button type="button" class="btn btn-default dropdown-toggle">
411425
Lint levels <span class="badge">{{selectedValuesCount(levels)}}</span> <span class="caret"></span>
@@ -524,7 +538,7 @@ <h1>Clippy Lints</h1>
524538
</ul>
525539
</div>
526540
</div>
527-
<div class="col-12 col-md-6 search-control">
541+
<div class="col-12 col-md-5 search-control">
528542
<div class="input-group">
529543
<label class="input-group-addon" id="filter-label" for="search-input">Filter:</label>
530544
<input type="text" class="form-control filter-input" placeholder="Keywords or search string" id="search-input"
@@ -537,6 +551,14 @@ <h1>Clippy Lints</h1>
537551
</span>
538552
</div>
539553
</div>
554+
<div class="col-12 col-md-2 btn-group expansion-group">
555+
<button title="Collapse All" class="btn btn-default expansion-control" type="button" ng-click="toggleExpansion(data, false)">
556+
<span class="glyphicon glyphicon-collapse-up"></span>
557+
</button>
558+
<button title="Expand All" class="btn btn-default expansion-control" type="button" ng-click="toggleExpansion(data, true)">
559+
<span class="glyphicon glyphicon-collapse-down"></span>
560+
</button>
561+
</div>
540562
</div>
541563
</div>
542564
<!-- The order of the filters should be from most likely to remove a lint to least likely to improve performance. -->

util/gh-pages/script.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@
469469
$location.path(lint.id);
470470
};
471471

472+
$scope.toggleExpansion = function(lints, isExpanded) {
473+
lints.forEach(lint => {
474+
$scope.open[lint.id] = isExpanded;
475+
});
476+
}
477+
472478
$scope.copyToClipboard = function (lint) {
473479
const clipboard = document.getElementById("clipboard-" + lint.id);
474480
if (clipboard) {

0 commit comments

Comments
 (0)