Skip to content

Commit 86597b8

Browse files
author
NooBxGockeL
committed
Added pattern statistics to the website, fixes iluwatar#465
Category and Tag count to the right of their headings and the pattern count at the bottom of the page
1 parent 3a9386d commit 86597b8

File tree

4 files changed

+34
-20
lines changed

4 files changed

+34
-20
lines changed

_includes/sidebar.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<label for="checkbox_allcats">
1212
Categories
1313
</label>
14+
<span class="amount-badge">
15+
{{ site.data.categories | size }}
16+
</span>
1417
</div>
1518

1619
{% for category in sortedCats %}
@@ -46,6 +49,9 @@
4649
<label for="checkbox_alltags">
4750
Tags
4851
</label>
52+
<span class="amount-badge">
53+
{{ site.data.tags | size }}
54+
</span>
4955
</div>
5056

5157
<!-- All / None Buttons -->

pages/patterns.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
{% assign allPatterns = site.pages | where:"layout","pattern" | sort: 'title' %}
1010
<div id="patterns" class="row">
11-
<!-- SIDEBAR -->
12-
<div class="col-md-3 col-md-push-9">
13-
{% include sidebar.html allItems=allPatterns %}
14-
</div>
11+
<!-- SIDEBAR -->
12+
<div class="col-md-3 col-md-push-9">
13+
{% include sidebar.html allItems=allPatterns %}
14+
</div>
1515
<!-- MAIN -->
1616
<div class="col-md-9 col-md-pull-3">
1717
<div class="content-area">
@@ -43,3 +43,8 @@
4343
</div>
4444
</div>
4545
</div>
46+
<div class="pattern-statistics row">
47+
<div class="col-md-9">
48+
Currently showing <span id="current-pattern-count-showing">{{ allPatterns | size }}</span> Patterns of {{ allPatterns | size }} Patterns total
49+
</div>
50+
</div>

static/css/index.scss

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,22 +203,16 @@ a {
203203
background-color: $base06;
204204
color: $base03;
205205
}
206-
.amount-badge {
207-
font-size: 12px;
208-
font-weight: bold;
209-
color: $base16-blue;
210-
border: 1px solid $base16-blue;
211-
//background-color: $base05;
212-
//padding: 0 0 1px 0;
213-
border-radius: 5px;
214-
float: right;
215-
width: 32px;
216-
text-align: center;
217-
}
218-
/*&:hover .amount-badge {
219-
@include transition(0.4s ease);
220-
@include transform(rotate(360deg) scale(1.2));
221-
}*/
206+
}
207+
.amount-badge {
208+
font-size: 12px;
209+
font-weight: bold;
210+
color: $base16-blue;
211+
border: 1px solid $base16-blue;
212+
border-radius: 5px;
213+
float: right;
214+
width: 32px;
215+
text-align: center;
222216
}
223217

224218
.checkbox label::before {
@@ -574,3 +568,9 @@ h6:hover .header-link {
574568
top: 45px !important;
575569
right: 45px !important;
576570
}
571+
572+
.pattern-statistics {
573+
color: $base02;
574+
font-style: italic;
575+
text-align: center;
576+
}

static/js/search.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ function updateResults() {
141141
} else if (text.length > 2) {
142142
intersectionQuery = EMPTY_QUERY;
143143
}
144+
// update the pattern counter
145+
$('#current-pattern-count-showing').text(intersectionQuery.length);
146+
144147
var diffQuery = $('.list-item').not(intersectionQuery);
145148
/* further narrow down to only REAL changes */
146149
diffQuery = diffQuery.filter(':visible');

0 commit comments

Comments
 (0)