3 input#modalContact.modal(type="checkbox")
4 div(role="dialog" aria-labelledby="contactTitle")
6 label.modal-close(for="modalContact")
7 h3#contactTitle.section {{ st.tr["Contact form"] }}
9 label(for="userEmail") {{ st.tr["Email"] }}
10 input#userEmail(type="email")
12 label(for="mailSubject") {{ st.tr["Subject"] }}
13 input#mailSubject(type="text")
15 label(for="mailContent") {{ st.tr["Content"] }}
19 button(type="button" @click="trySendMessage") Send
20 p#emailSent {{ st.tr["Email sent!"] }}
24 import { ajax } from "../utils/ajax";
25 import { store } from "@/store";
26 import { checkNameEmail } from "@/data/userCheck";
29 name: "my-contact-form",
36 // Note: not using Vue here, but would be possible
37 trySendMessage: function() {
38 let email = document.getElementById("userEmail");
39 let subject = document.getElementById("mailSubject");
40 let content = document.getElementById("mailContent");
41 const error = checkNameEmail({email: email});
44 if (content.value.trim().length == 0)
45 return alert("Empty message");
46 if (subject.value.trim().length == 0 && !confirm("No subject. Send anyway?"))
55 subject: subject.value,
56 content: content.value,
61 let emailSent = document.getElementById("emailSent");
62 emailSent.style.display = "inline-block";
63 setTimeout(() => { emailSent.style.display = "none"; }, 2000);