1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

form: show radios for only linked contact methods

This commit is contained in:
Harvey Tindall 2022-01-27 16:56:13 +00:00
parent dbefb80f63
commit 25451eb763
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 12 additions and 6 deletions

View File

@ -126,21 +126,21 @@
{{ end }} {{ end }}
{{ if or (.telegramEnabled) (or .discordEnabled .matrixEnabled) }} {{ if or (.telegramEnabled) (or .discordEnabled .matrixEnabled) }}
<div id="contact-via" class="unfocused"> <div id="contact-via" class="unfocused">
<label class="row switch pb-4"> <label class="row switch pb-4 unfocused">
<input type="radio" name="contact-via" value="email" class="mr-2"><span>Contact through Email</span> <input type="radio" name="contact-via" value="email" id="contact-via-email" class="mr-2"><span>Contact through Email</span>
</label> </label>
{{ if .telegramEnabled }} {{ if .telegramEnabled }}
<label class="row switch pb-4"> <label class="row switch pb-4 unfocused">
<input type="radio" name="contact-via" value="telegram" id="contact-via-telegram" class="mr-2"><span>Contact through Telegram</span> <input type="radio" name="contact-via" value="telegram" id="contact-via-telegram" class="mr-2"><span>Contact through Telegram</span>
</label> </label>
{{ end }} {{ end }}
{{ if .discordEnabled }} {{ if .discordEnabled }}
<label class="row switch pb-4"> <label class="row switch pb-4 unfocused">
<input type="radio" name="contact-via" value="discord" id="contact-via-discord" class="mr-2"><span>Contact through Discord</span> <input type="radio" name="contact-via" value="discord" id="contact-via-discord" class="mr-2"><span>Contact through Discord</span>
</label> </label>
{{ end }} {{ end }}
{{ if .matrixEnabled }} {{ if .matrixEnabled }}
<label class="row switch pb-4"> <label class="row switch pb-4 unfocused">
<input type="radio" name="contact-via" value="matrix" id="contact-via-matrix" class="mr-2"><span>Contact through Matrix</span> <input type="radio" name="contact-via" value="matrix" id="contact-via-matrix" class="mr-2"><span>Contact through Matrix</span>
</label> </label>
{{ end }} {{ end }}

View File

@ -70,7 +70,9 @@ if (window.telegramEnabled) {
setTimeout(window.telegramModal.close, 2000); setTimeout(window.telegramModal.close, 2000);
telegramButton.classList.add("unfocused"); telegramButton.classList.add("unfocused");
document.getElementById("contact-via").classList.remove("unfocused"); document.getElementById("contact-via").classList.remove("unfocused");
document.getElementById("contact-via-email").parentElement.classList.remove("unfocused");
const radio = document.getElementById("contact-via-telegram") as HTMLInputElement; const radio = document.getElementById("contact-via-telegram") as HTMLInputElement;
radio.parentElement.classList.remove("unfocused");
radio.checked = true; radio.checked = true;
validatorFunc(); validatorFunc();
} else if (!modalClosed) { } else if (!modalClosed) {
@ -131,7 +133,9 @@ if (window.discordEnabled) {
setTimeout(window.discordModal.close, 2000); setTimeout(window.discordModal.close, 2000);
discordButton.classList.add("unfocused"); discordButton.classList.add("unfocused");
document.getElementById("contact-via").classList.remove("unfocused"); document.getElementById("contact-via").classList.remove("unfocused");
document.getElementById("contact-via-email").parentElement.classList.remove("unfocused");
const radio = document.getElementById("contact-via-discord") as HTMLInputElement; const radio = document.getElementById("contact-via-discord") as HTMLInputElement;
radio.parentElement.classList.remove("unfocused")
radio.checked = true; radio.checked = true;
validatorFunc(); validatorFunc();
} else if (!modalClosed) { } else if (!modalClosed) {
@ -190,7 +194,9 @@ if (window.matrixEnabled) {
matrixPIN = input.value; matrixPIN = input.value;
matrixButton.classList.add("unfocused"); matrixButton.classList.add("unfocused");
document.getElementById("contact-via").classList.remove("unfocused"); document.getElementById("contact-via").classList.remove("unfocused");
const radio = document.getElementById("contact-via-discord") as HTMLInputElement; document.getElementById("contact-via-email").parentElement.classList.remove("unfocused");
const radio = document.getElementById("contact-via-matrix") as HTMLInputElement;
radio.parentElement.classList.remove("unfocused");
radio.checked = true; radio.checked = true;
validatorFunc(); validatorFunc();
} else { } else {