mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
form: change contact-via radios to checks
This commit is contained in:
parent
c0f2409fcc
commit
bfeab3648c
@ -85,21 +85,21 @@
|
||||
{{ if or (.telegramEnabled) (or .discordEnabled .matrixEnabled) }}
|
||||
<div id="contact-via" class="unfocused">
|
||||
<label class="row switch pb-4 unfocused">
|
||||
<input type="radio" name="contact-via" value="email" id="contact-via-email" class="mr-2"><span>Contact through Email</span>
|
||||
<input type="checkbox" name="contact-via" value="email" id="contact-via-email" class="mr-2"><span>Contact through Email</span>
|
||||
</label>
|
||||
{{ if .telegramEnabled }}
|
||||
<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="checkbox" name="contact-via" value="telegram" id="contact-via-telegram" class="mr-2"><span>Contact through Telegram</span>
|
||||
</label>
|
||||
{{ end }}
|
||||
{{ if .discordEnabled }}
|
||||
<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="checkbox" name="contact-via" value="discord" id="contact-via-discord" class="mr-2"><span>Contact through Discord</span>
|
||||
</label>
|
||||
{{ end }}
|
||||
{{ if .matrixEnabled }}
|
||||
<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="checkbox" name="contact-via" value="matrix" id="contact-via-matrix" class="mr-2"><span>Contact through Matrix</span>
|
||||
</label>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
43
ts/form.ts
43
ts/form.ts
@ -67,9 +67,9 @@ if (window.telegramEnabled) {
|
||||
telegramButton.classList.add("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;
|
||||
radio.parentElement.classList.remove("unfocused");
|
||||
radio.checked = true;
|
||||
const checkbox = document.getElementById("contact-via-telegram") as HTMLInputElement;
|
||||
checkbox.parentElement.classList.remove("unfocused");
|
||||
checkbox.checked = true;
|
||||
validator.validate();
|
||||
}
|
||||
};
|
||||
@ -99,9 +99,9 @@ if (window.discordEnabled) {
|
||||
discordButton.classList.add("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;
|
||||
radio.parentElement.classList.remove("unfocused")
|
||||
radio.checked = true;
|
||||
const checkbox = document.getElementById("contact-via-discord") as HTMLInputElement;
|
||||
checkbox.parentElement.classList.remove("unfocused")
|
||||
checkbox.checked = true;
|
||||
validator.validate();
|
||||
}
|
||||
};
|
||||
@ -131,9 +131,9 @@ if (window.matrixEnabled) {
|
||||
matrixButton.classList.add("unfocused");
|
||||
document.getElementById("contact-via").classList.remove("unfocused");
|
||||
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;
|
||||
const checkbox = document.getElementById("contact-via-matrix") as HTMLInputElement;
|
||||
checkbox.parentElement.classList.remove("unfocused");
|
||||
checkbox.checked = true;
|
||||
validator.validate();
|
||||
}
|
||||
};
|
||||
@ -298,7 +298,7 @@ const create = (event: SubmitEvent) => {
|
||||
if (window.captcha && !window.reCAPTCHA && !captchaVerified) {
|
||||
|
||||
}
|
||||
toggleLoader(submitSpan);
|
||||
addLoader(submitSpan);
|
||||
let send: sendDTO = {
|
||||
code: window.code,
|
||||
username: usernameField.value,
|
||||
@ -307,22 +307,22 @@ const create = (event: SubmitEvent) => {
|
||||
};
|
||||
if (telegramVerified) {
|
||||
send.telegram_pin = window.telegramPIN;
|
||||
const radio = document.getElementById("contact-via-telegram") as HTMLInputElement;
|
||||
if (radio.checked) {
|
||||
const checkbox = document.getElementById("contact-via-telegram") as HTMLInputElement;
|
||||
if (checkbox.checked) {
|
||||
send.telegram_contact = true;
|
||||
}
|
||||
}
|
||||
if (discordVerified) {
|
||||
send.discord_pin = window.discordPIN;
|
||||
const radio = document.getElementById("contact-via-discord") as HTMLInputElement;
|
||||
if (radio.checked) {
|
||||
const checkbox = document.getElementById("contact-via-discord") as HTMLInputElement;
|
||||
if (checkbox.checked) {
|
||||
send.discord_contact = true;
|
||||
}
|
||||
}
|
||||
if (matrixVerified) {
|
||||
send.matrix_pin = matrixPIN;
|
||||
const radio = document.getElementById("contact-via-matrix") as HTMLInputElement;
|
||||
if (radio.checked) {
|
||||
const checkbox = document.getElementById("contact-via-matrix") as HTMLInputElement;
|
||||
if (checkbox.checked) {
|
||||
send.matrix_contact = true;
|
||||
}
|
||||
}
|
||||
@ -335,7 +335,8 @@ const create = (event: SubmitEvent) => {
|
||||
}
|
||||
}
|
||||
_post("/newUser", send, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
if (req.readyState != 4) return;
|
||||
removeLoader(submitSpan);
|
||||
let vals = req.response as ValidatorRespDTO;
|
||||
let valid = true;
|
||||
for (let type in vals) {
|
||||
@ -354,7 +355,7 @@ const create = (event: SubmitEvent) => {
|
||||
}
|
||||
window.successModal.show();
|
||||
}
|
||||
} else {
|
||||
} else if (req.status != 401 && req.status != 400){
|
||||
submitSpan.classList.add("~critical");
|
||||
submitSpan.classList.remove("~urge");
|
||||
if (req.response["error"] as string) {
|
||||
@ -368,10 +369,9 @@ const create = (event: SubmitEvent) => {
|
||||
submitSpan.textContent = submitText;
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}, true, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
toggleLoader(submitSpan);
|
||||
if (req.readyState != 4) return;
|
||||
removeLoader(submitSpan);
|
||||
if (req.status == 401 || req.status == 400) {
|
||||
if (req.response["error"] as string) {
|
||||
if (req.response["error"] == "confirmEmail") {
|
||||
@ -386,7 +386,6 @@ const create = (event: SubmitEvent) => {
|
||||
setTimeout(() => { submitSpan.textContent = submitText; }, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user