29 lines
1.1 KiB
Plaintext
29 lines
1.1 KiB
Plaintext
{{ block "imageInput" . }}
|
|
<label for="{{.Name}}"
|
|
{{template "labelStyle"}}>
|
|
{{.Label}}
|
|
</label>
|
|
<input type="file" id="{{.Name}}"
|
|
accept="image/png, image/jpeg"
|
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
capture="user"
|
|
name="{{.Name}}"
|
|
value="{{.Value}}"/>
|
|
<label for="{{.Name}}-userInput">User Camera</label>
|
|
<input type="checkbox" id="{{.Name}}-userInput" checked>
|
|
|
|
<script>
|
|
(() => {
|
|
const input = document.getElementById('{{.Name}}')
|
|
const checkbox = document.getElementById('{{.Name}}-userInput')
|
|
checkbox.addEventListener('change', function () {
|
|
if (checkbox.checked) {
|
|
input.setAttribute('capture', 'user')
|
|
} else {
|
|
input.removeAttribute('capture')
|
|
}
|
|
})
|
|
})()
|
|
</script>
|
|
{{ end }}
|