<template lang="pug">
div
input#modalContact.modal(type="checkbox")
- div(role="dialog" aria-labelledby="contactTitle")
+ div(role="dialog" data-checkbox="modalContact"
+ aria-labelledby="contactTitle")
form.card.smallpad
label.modal-close(for="modalContact")
- h3#contactTitle.section {{ $tr["Contact form"] }}
+ h3#contactTitle.section {{ st.tr["Contact form"] }}
fieldset
- label(for="userEmail") {{ $tr["Email"] }}
+ label(for="userEmail") {{ st.tr["Email"] }}
input#userEmail(type="email")
fieldset
- label(for="mailSubject") {{ $tr["Subject"] }}
+ label(for="mailSubject") {{ st.tr["Subject"] }}
input#mailSubject(type="text")
fieldset
- label(for="mailContent") {{ $tr["Content"] }}
+ label(for="mailContent") {{ st.tr["Content"] }} *
br
textarea#mailContent
fieldset
- button(type="button" onClick="trySendMessage()") Send
- p#emailSent {{ $tr["Email sent!"] }}
+ button(type="button" @click="trySendMessage") Send
+ p#emailSent {{ st.tr["Email sent!"] }}
</template>
<script>
import { ajax } from "../utils/ajax";
+import { store } from "@/store";
+import { checkNameEmail } from "@/data/userCheck";
+
export default {
- name: "ContactForm",
- methods: {
- // Note: not using Vue here, but would be possible
+ name: "my-contact-form",
+ data: function() {
+ return {
+ st: store.state,
+ };
+ },
+ methods: {
+ // Note: not using Vue here, but would be possible
trySendMessage: function() {
let email = document.getElementById("userEmail");
let subject = document.getElementById("mailSubject");
if (!!error)
return alert(error);
if (content.value.trim().length == 0)
- return alert("Empty message");
- if (subject.value.trim().length == 0 && !confirm("No subject. Send anyway?"))
+ return alert(this.st.tr["Empty message"]);
+ if (subject.value.trim().length == 0 && !confirm(this.st.tr["No subject. Send anyway?"]))
return;
// Message sending:
}
);
},
- },
+ },
};
</script>
+
+<style lang="sass" scoped>
+#emailSent
+ color: blue
+ display: none
+</style>