Browse Source

Using shortcodes instead of abusing layouts

master
Mobius K 10 months ago
parent
commit
3b239390a3
  1. 19
      content/_index.html
  2. 92
      layouts/index.html
  3. 18
      layouts/shortcodes/major-devices.html
  4. 19
      layouts/shortcodes/major-services.html
  5. 35
      layouts/shortcodes/minor-devices.html

19
content/_index.html

@ -1,3 +1,22 @@
---
title: Code builder
layout: single
---
<!-- Code result of the generated form below -->
<p>
<a href="https://www.systutorials.com/docs/linux/man/8-hciconfig/">hciconfig</a>
device identification command:
<kbd>
hciconfig 0 class <span id="bluetoothClass"></span>
</kbd>
</p>
<!-- Input selections per BlueTooth class group -->
{{< major-services >}}
{{< major-devices >}}
{{< minor-devices >}}

92
layouts/index.html

@ -1,92 +0,0 @@
{{ define "main" }}
<!-- Code result of the generated form below -->
<p>
<a href="https://www.systutorials.com/docs/linux/man/8-hciconfig/">hciconfig</a>
device identification command:
<kbd>
hciconfig 0 class <span id="bluetoothClass"></span>
</kbd>
</p>
<!-- Input selections per BlueTooth class group -->
<h2>Major service</h2>
<div class="uk-grid uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l">
{{ range .Site.Data.codes.majorServices }}
{{ range $key, $value := . }}
<div>
<label>
<input
class="uk-checkbox"
id="majorService-{{ $key }}"
type="checkbox"
value={{ $key }}
>
{{ $value }}
</label>
</div>
{{ end }}
{{ end }}
</div>
<h3>Major device</h3>
<div class="uk-grid uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l">
{{ range .Site.Data.codes.majorDevices }}
<div>
<label>
<input
class="uk-radio"
id="majorDevice-{{ .code }}"
name="majorDevice"
type="radio"
value={{ .code }}
>
{{ .title }}
</label>
</div>
{{ end }}
</div>
<h4>Minor device</h4>
<div class="minor-devices">
{{ range .Site.Data.codes.majorDevices }}
{{ $majorDevice := print "majorDevice-" .code }}
<div class="{{ $majorDevice }} uk-grid uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l">
{{ range .minorDevices }}
{{ range $key, $value := . }}
<div>
<label>
<input
class="uk-radio"
id="minorDevice-{{ $majorDevice }}-{{ $key }}"
name="minorDevice-{{ $majorDevice }}"
type="radio"
value={{ $key }}
>
{{ $value }}
</label>
</div>
{{ end }}
{{ else }}
<div class="uk-width-expand">
<span>
No options for this combination
</span>
</div>
{{ end }}
</div>
{{ end }}
</div>
{{ .Content }}
{{ end }}

18
layouts/shortcodes/major-devices.html

@ -0,0 +1,18 @@
<h3>Major device</h3>
<div class="uk-grid uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l">
{{ range .Site.Data.codes.majorDevices }}
<div>
<label>
<input
class="uk-radio"
id="majorDevice-{{ .code }}"
name="majorDevice"
type="radio"
value={{ .code }}
>
{{ .title }}
</label>
</div>
{{ end }}
</div>

19
layouts/shortcodes/major-services.html

@ -0,0 +1,19 @@
<h2>Major service</h2>
<div class="uk-grid uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l">
{{ range .Site.Data.codes.majorServices }}
{{ range $key, $value := . }}
<div>
<label>
<input
class="uk-checkbox"
id="majorService-{{ $key }}"
type="checkbox"
value={{ $key }}
>
{{ $value }}
</label>
</div>
{{ end }}
{{ end }}
</div>

35
layouts/shortcodes/minor-devices.html

@ -0,0 +1,35 @@
<h4>Minor device</h4>
<div class="minor-devices">
{{ range .Site.Data.codes.majorDevices }}
{{ $majorDevice := print "majorDevice-" .code }}
<div class="{{ $majorDevice }} uk-grid uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-child-width-1-4@l">
{{ range .minorDevices }}
{{ range $key, $value := . }}
<div>
<label>
<input
class="uk-radio"
id="minorDevice-{{ $majorDevice }}-{{ $key }}"
name="minorDevice-{{ $majorDevice }}"
type="radio"
value={{ $key }}
>
{{ $value }}
</label>
</div>
{{ end }}
{{ else }}
<div class="uk-width-expand">
<span>
No options for this combination
</span>
</div>
{{ end }}
</div>
{{ end }}
</div>
Loading…
Cancel
Save