Skip to content

Commit

Permalink
Added device standards & types to navigation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanadams committed Oct 10, 2019
1 parent 96d3499 commit f09fb40
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 75 deletions.
4 changes: 4 additions & 0 deletions _device-standards/eu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: EU
title: EU Devices
---
4 changes: 4 additions & 0 deletions _device-standards/global.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: global
title: Global Devices
---
4 changes: 4 additions & 0 deletions _device-standards/uk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: uk
title: UK Devices
---
4 changes: 4 additions & 0 deletions _device-standards/us.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: us
title: US Devices
---
4 changes: 4 additions & 0 deletions _device-types/light.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: light
title: Lights & LEDs
---
4 changes: 4 additions & 0 deletions _device-types/misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: misc
title: Miscellaneous Devices
---
4 changes: 4 additions & 0 deletions _device-types/plug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: plug
title: Plugs & Sockets
---
4 changes: 4 additions & 0 deletions _device-types/relay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: relay
title: Relays
---
4 changes: 4 additions & 0 deletions _device-types/sensor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: sensor
title: Sensors
---
4 changes: 4 additions & 0 deletions _device-types/switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: switch
title: Switches & Dimmers
---
86 changes: 11 additions & 75 deletions _includes/nav.html
Original file line number Diff line number Diff line change
@@ -1,91 +1,27 @@
<nav role="navigation" aria-label="Main navigation">
<ul class="navigation-list">
<strong>Device Types</strong>
{% assign deviceTypes_array = "" | split:"|" %}

{% for post in site.devices %}
{% for type in post.type %}
{% assign deviceTypes_array = deviceTypes_array | push: type | uniq | sort: "type" %}
{% endfor %}
{% endfor %}

{% for type in deviceTypes_array %}

{% if type == "plug" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">Plugs & Sockets</a>
</li>
{% endif %}

{% if type == "light" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">Light Bulbs & LEDs</a>
</li>
{% endif %}

{% if type == "switch" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">Switches & Dimmers</a>
</li>
{% endif %}

{% if type == "relay" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">Relays</a>
</li>
{% endif %}

{% if type == "misc" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">Miscellaneous Devices</a>
</li>
{% endif %}

{% for type in site.device-types | sort: "title" %}
<li>
<a href="{{ type.url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ type.title }}</a>
</li>
{% endfor %}

<br>
<strong>Electrical Standards</strong>
{% assign electricalStandards_array = "" | split:"|" %}
{% for post in site.devices %}
{% for standard in post.standard %}
{% assign electricalStandards_array = electricalStandards_array | push: standard | uniq | sort: "standard %}
{% endfor %}
{% endfor %}

{% for type in electricalStandards_array %}

{% if type == "uk" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">UK Devices</a>
</li>
{% endif %}

{% if type == "us" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">US Devices</a>
</li>
{% endif %}

{% if type == "eu" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">EU Devices</a>
</li>
{% endif %}

{% if type == "global" %}
<li>
<a href="#" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">Global Devices</a>
</li>
{% endif %}

{% for standard in site.device-standards | sort: "title" %}
<li>
<a href="{{ standard.url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ standard.title }}</a>
</li>
{% endfor %}

<br>
<strong>External Links</strong>
{% for item in site.data.external_links %}
{% for link in site.data.external_links %}
<li>
<a href="{{ item.url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ item.name }}</a>
<a href="{{ link.url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ link.name }}</a>
</li>
{% endfor %}

</ul>
</nav>
15 changes: 15 additions & 0 deletions _layouts/device-standards-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: default
---

<h1>Electrical Standard: {{ page.title }}</h1>

<ul>
{% for device in site.devices %}
{% if device.standard contains page.slug %}
<li>
<a href="{{ device.url }}">{{ device.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
15 changes: 15 additions & 0 deletions _layouts/device-types-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: default
---

<h1>Device Type: {{ page.title }}</h1>

<ul>
{% for device in site.devices %}
{% if device.type contains page.slug %}
<li>
<a href="{{ device.url }}">{{ device.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>

0 comments on commit f09fb40

Please sign in to comment.