diff options
| author | Julian Hurst <julian.hurst92@gmail.com> | 2020-10-16 11:59:13 +0200 |
|---|---|---|
| committer | Julian Hurst <julian.hurst92@gmail.com> | 2020-10-16 11:59:13 +0200 |
| commit | e949e31dcb6959b6352f2f9123b945e7432da7cf (patch) | |
| tree | b140f15475ebb881818c3d7c69bae9eca5e6d324 /templates | |
| parent | 5a1ed892243de630ebb0e145e7989193eab4bdb6 (diff) | |
| download | grimtube-e949e31dcb6959b6352f2f9123b945e7432da7cf.tar.gz | |
Available langs as slice
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/index.html | 6 | ||||
| -rw-r--r-- | templates/search.html | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/templates/index.html b/templates/index.html index 4b16728..434a34f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,9 +3,9 @@ <form action="/search" method="get"> <input id="term" name="term" type="text" placeholder="search" required> <select id="lang" name="lang"> - <option>en</option> - <option>fr</option> - <option>de</option> + {{range .Langs}} + <option> {{.}}</option> + {{end}} </select> </form> {{end}} diff --git a/templates/search.html b/templates/search.html index e5a8e34..8a75962 100644 --- a/templates/search.html +++ b/templates/search.html @@ -3,9 +3,13 @@ <form action="/search" method="get"> <input id="term" name="term" type="text" placeholder="search" required> <select id="lang" name="lang"> - <option>en</option> - <option>fr</option> - <option>de</option> + {{range .Langs}} + {{if eq . $.Lang}} + <option selected>{{.}}</option> + {{else}} + <option>{{.}}</option> + {{end}} + {{end}} </select> </form> <table> |
