Repository navigation
Expand file tree
/
Copy pathdownloads.html
More file actions
152 lines (147 loc) · 5.74 KB
/
Copy pathdownloads.html
File metadata and controls
152 lines (147 loc) · 5.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
layout: default
title: Downloads
permalink: /downloads
---
<div id="downloads-page">
<h1>Downloads</h1>
<div class="downloads-inputs">
<div class="downloads-search">
<label class="search-wrapper">
<input type="text" id="search" placeholder="Search for CircuitPython boards" />
</label>
</div>
<div class="downloads-filter">
<button class="filter" title="Filter Boards"><i class="fas fa-sliders-h"
aria-hidden="true"></i> Filters</button>
</div>
<div class="downloads-filter-tags">
</div>
</div>
<div class="downloads-filter-content">
<div class="filter-buttons">
<button class="save-changes" title="Close and Save Changes"><i class="fas fa-times" aria-hidden="true"></i></button>
</div>
<div>
<div class="manufacturers">
<fieldset>
<legend>Manufacturers</legend>
<ul class="content"></ul>
</fieldset>
</div>
<div class="features">
<fieldset>
<legend>Features</legend>
<ul class="content"></ul>
</fieldset>
</div>
<div class="sort-by">
<fieldset>
<legend>Sort By</legend>
<ul class="content">
<li><input type="radio" name="sort-by" value="downloads" aria-label="Downloads" checked> Downloads</li>
<li><input type="radio" name="sort-by" value="alpha-asc" aria-label="Board Name (A to Z)"> Board Name (A to Z)</li>
<li><input type="radio" name="sort-by" value="alpha-desc" aria-label="Board Name (Z to A)"> Board Name (Z to A)</li>
<li><input type="radio" name="sort-by" value="date-desc" aria-label="Date Added (Newest First)"> Date Added (Newest First)</li>
<li><input type="radio" name="sort-by" value="date-asc" aria-label="Date Added (Oldest First)"> Date Added (Oldest First)</li>
</ul>
</fieldset>
</div>
</div>
</div>
<div class="download-count">
{% comment %}
Get a total number of boards by running through both loops
to get an accurate total.
{% endcomment %}
{% assign board_count = 0 %}
{% assign boards = site.data.files %}
{% for board in boards %}
{% assign info = site.board | where: 'board_id', board.id %}
{% if info.size == 0 %}
{% assign info = site.board | where: 'board_id', 'unknown' %}
{% endif %}
{% assign info = info[0] %}
{% if info.downloads_display == false %}
{% continue %}
{% endif %}
{% assign board_count = board_count | plus: 1 %}
{% endfor %}
{% for board in site.board %}
{% assign info = site.data.files | where: 'id', board.board_id | first %}
{% if info == nil and board.board_id != 'unknown' %}
{% if board.downloads_display == false %}
{% continue %}
{% endif %}
{% assign board_count = board_count | plus: 1 %}
{% endif %}
{% endfor %}
Displaying <span id="board_count">{{ board_count }}</span> boards.
</div>
<div class="downloads-section">
{% comment %}
The following are boards that are in the _data/files.json build
process. Separate loops due to wanting to sort by download count first.
{% endcomment %}
{% assign boards = site.data.files | sort: "downloads" | reverse %}
{% for board in boards %}
{% assign info = site.board | where: 'board_id', board.id %}
{% if info.size == 0 %}
{% assign info = site.board | where: 'board_id', 'unknown' %}
{% endif %}
{% assign info = info[0] %}
{% if info.downloads_display == false %}
{% continue %}
{% endif %}
<div class="download" data-id="{{ board.id }}"
data-name="{{ info.name | default: board.id }}"
data-downloads="{{ board.downloads }}"
data-manufacturer="{{ info.manufacturer }}"
data-features="{{ info.features | join: ','}}"
data-date="{{ info.date_added }}">
<a href="{{ info.url | relative_url }}">
<div>
<div class="img-responsive-4by3">
{% include downloads/board_image.html board_image=info.board_image %}
</div>
<div class="details">
<h3>{{ info.name | default: board.id }}</h3>
By {{ info.manufacturer }}
</div>
</div>
</a>
</div>
{% endfor %}
{% comment %}
The following are boards that are not yet in the _data/files.json build
process and have no downloads.
{% endcomment %}
{% for board in site.board %}
{% assign info = site.data.files | where: 'id', board.board_id | first %}
{% if info == nil and board.board_id != 'unknown' %}
{% if board.downloads_display == false %}
{% continue %}
{% endif %}
<div class="download" data-id="{{ board.board_id }}"
data-name="{{ board.name }}"
data-downloads="0"
data-manufacturer="{{ board.manufacturer }}"
data-features="{{ board.features | join: ','}}"
data-date="{{ board.date_added }}">
<a href="{{ board.url | relative_url }}">
<div>
<div class="img-responsive-4by3">
{% include downloads/board_image.html board_image=board.board_image %}
</div>
<div class="details">
<h3>{{ board.name }}</h3>
By {{ board.manufacturer }}
</div>
</div>
</a>
</div>
{% endif %}
{% endfor %}
</div>
</div>
<script src="/assets/javascript/downloads.js"></script>