searchable select if js is enabled
All checks were successful
mozhi pipeline / Push Docker image to Codeberg docker registry (push) Successful in 2m59s
mozhi pipeline / Build and publish artifacts (push) Successful in 13m27s

This commit is contained in:
2023-09-10 20:22:51 +05:30
parent 197296e91f
commit 527877a321
5 changed files with 20 additions and 2 deletions

View File

@@ -14,6 +14,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<meta name="referrer" content="no-referrer" />
<script src="/js/nice-select2.js"></script>
<link rel="stylesheet" href="/css/nice-select2.css">
<link rel="stylesheet" href="/css/style.css" />
</head>

View File

@@ -19,7 +19,7 @@
<div class="wrap languages">
<div class="language">
<select name="from" aria-label="Source language">
<select name="from" aria-label="Source language" id="sourceLanguage">
{{range $key, $value := .SourceLanguages}} {{if $.From}}
<option value="{{ .Id }}" {{if eq $.From .Id}}selected{{end}}>
{{ .Name }}
@@ -44,7 +44,7 @@
</div>
<div class="language">
<select name="to" aria-label="Target language">
<select name="to" aria-label="Target language" id="targetLanguage">
{{range $key, $value := .TargetLanguages}}
<option value="{{ .Id }}" {{if eq $.To .Id}}selected{{end}}>
{{ .Name }}
@@ -107,6 +107,10 @@
document.getElementById("translation-form").submit();
}
});
var options = { searchable: true };
NiceSelect.bind(document.getElementById("targetLanguage"), options);
var options = { searchable: true };
NiceSelect.bind(document.getElementById("sourceLanguage"), options);
</script>
</main>
{{ template "footer" .}}