Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag dropdowns #690

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions website/layouts/_default/term.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<main>
{{ $title := printf "Tag: %s" .Title}}
{{ partial "banner.html" (dict "title" $title "description" .Description) }}
<div class="dropdown-container">
{{ partial "vendordropdown.html" . }}
{{ partial "freqdropdown.html" . }}
</div>
{{ partial "device-list.html" (dict "devices" ( .Pages ) ) }}
</main>
{{ end }}
4 changes: 4 additions & 0 deletions website/layouts/devices/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{ define "main" }}
<main>
{{ partial "banner.html" (dict "title" .Title "description" .Description) }}
<div class="dropdown-container">
{{ partial "vendordropdown.html" . }}
{{ partial "freqdropdown.html" . }}
</div>
{{ partial "device-list.html" (dict "devices" ( .Pages ) ) }}
</main>
{{ end }}
21 changes: 21 additions & 0 deletions website/layouts/partials/freqdropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Frequency Plan Dropdown -->
<select id="frequencyPlanDropdown">
<option value="" selected disabled>Select a Frequency</option>
<option value="as923">AS923</option>
<option value="au915-928">AU915-928</option>
<option value="cn470-510">CN470-510</option>
<option value="eu863-870">EU863-870</option>
<option value="eu433">EU433</option>
<option value="in865-867">IN865-867</option>
<option value="kr920-923">KR920-923</option>
<option value="ru864-870">RU864-870</option>
<option value="us902-928">US902-928</option>
</select>
<script>
document.getElementById("frequencyPlanDropdown").addEventListener("change", function() {
var selectedFrequencyPlan = this.value;
if (selectedFrequencyPlan) {
window.location.href = "{{ .Site.BaseURL }}tags/" + selectedFrequencyPlan + "/";
}
});
</script>
30 changes: 30 additions & 0 deletions website/layouts/partials/vendordropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<select id="vendorDropdown">
<option value="" selected disabled>Select a Vendor</option>
{{ $uniqueVendors := dict }}
{{ $sortedVendors := slice }}
{{ range .Site.RegularPages }}
{{ with .Params.vendor }}
{{ $vendorID := .id | urlize }}
{{ $vendorName := .name }}
{{ with index $uniqueVendors $vendorID }}
{{/* Vendor already encountered, do nothing */}}
{{ else }}
{{ $uniqueVendors = $uniqueVendors | merge (dict $vendorID $vendorName) }}
{{ $sortedVendors = $sortedVendors | append $vendorID }}
{{ end }}
{{ end }}
{{ end }}
{{ $sortedVendors = sort $sortedVendors }}
{{ range $sortedVendors }}
<option value="{{ . }}">{{ index $uniqueVendors . }}</option>
{{ end }}
</select>
<script>
document.getElementById("vendorDropdown").addEventListener("change", function() {
var selectedVendor = this.value;
if (selectedVendor) {
// Redirect to the URL for the selected vendor
window.location.href = "{{ .Site.BaseURL }}devices/" + selectedVendor + "/";
}
});
</script>
16 changes: 16 additions & 0 deletions website/src/styles/global.styl
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,19 @@ a
margin: var(--cs-xl3) auto
max-width: var(--bp-l)
padding: 0 var(--ls-xs) var(--ls-xs)

select
color: black
background: #26A0FF
border: none
border-radius: 0.5em
border-style: solid
margin: 10px
width: 20%
padding: 0.75em
margin-bottom: var(--ls-xs)

.dropdown-container
display: flex;
justify-content: center
align-items: center