Changes
Build and Push Docker Images / build (push) Successful in 18s

This commit is contained in:
2026-05-12 11:11:06 +03:00
parent 4eaae45cba
commit 19e3526430
4 changed files with 148 additions and 39 deletions
+72 -26
View File
@@ -48,6 +48,10 @@
"form.captchaFailed": "Captcha verification failed.",
"form.failed": "Failed to send the message.",
"form.rateLimited": "Too many requests from your network. Please wait a moment and try again.",
"form.required.name": "Please enter your name.",
"form.required.email": "Please enter your email address.",
"form.required.emailInvalid": "Please enter a valid email address.",
"form.required.message": "Please write a message.",
"subscribe.title": "Stay in the loop",
"subscribe.text": "Get a short note when a new AI demo is published. One email at most every few weeks.",
"subscribe.emailPlaceholder": "name@company.com",
@@ -153,6 +157,10 @@
"form.captchaFailed": "Verificarea Captcha a eșuat.",
"form.failed": "Mesajul nu a putut fi trimis.",
"form.rateLimited": "Prea multe cereri din rețeaua ta. Te rugăm să aștepți câteva momente și să încerci din nou.",
"form.required.name": "Te rugăm să introduci numele.",
"form.required.email": "Te rugăm să introduci adresa de email.",
"form.required.emailInvalid": "Te rugăm să introduci o adresă de email validă.",
"form.required.message": "Te rugăm să scrii un mesaj.",
"subscribe.title": "Rămâi la curent",
"subscribe.text": "Primești o notă scurtă când publicăm un nou demo AI. Cel mult un email la câteva săptămâni.",
"subscribe.emailPlaceholder": "nume@companie.ro",
@@ -393,6 +401,27 @@
$('#msgSubmit').removeClass().addClass('form-message ' + tone).text(msg);
}
function showFieldError(errorId, msg) {
var $el = $('#' + errorId);
$el.text(msg || '');
// Look first at the parent (for errors nested inside a label),
// then at the previous sibling block (for errors after consent/file-drop/subscribe-row).
var $parent = $el.parent();
var $container = $parent.is('label, .consent-inline') ? $parent : $el.prev();
if (!$container.length || !$container.is('label, .consent-inline, .file-drop, .subscribe-row')) {
$container = $el.closest('form');
}
$container.toggleClass('is-invalid', !!msg);
}
function clearFieldErrors(errorIds) {
for (var i = 0; i < errorIds.length; i++) showFieldError(errorIds[i], '');
}
function isValidEmail(value) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value || '').trim());
}
function formSuccess() {
$('#contactForm')[0].reset();
submitMSG(true, t('form.thanks'));
@@ -408,22 +437,35 @@
event.preventDefault();
var loader = $('#contactLoader'),
button = $('#submit');
var name = $('#name').val().trim();
var email = $('#email').val().trim();
var message = $('#message').val().trim();
clearFieldErrors(['nameError', 'emailError', 'messageError']);
$('#msgSubmit').removeClass().addClass('form-message').text('');
var hasError = false;
if (!name) { showFieldError('nameError', t('form.required.name')); hasError = true; }
if (!email) { showFieldError('emailError', t('form.required.email')); hasError = true; }
else if (!isValidEmail(email)) { showFieldError('emailError', t('form.required.emailInvalid')); hasError = true; }
if (!message) { showFieldError('messageError', t('form.required.message')); hasError = true; }
if (hasError) return;
loader.css('display', 'flex');
button.prop('disabled', true);
$('#msgSubmit').text('');
function postContact(token) {
var message = {
Name: $('#name').val(),
Email: $('#email').val(),
var payload = {
Name: name,
Email: email,
Subject: '[MyAi.ro contact request]',
Message: $('#message').val(),
Message: message,
CaptchaToken: token || ''
};
$.ajax({
type: 'POST',
url: '/api/contact',
data: JSON.stringify(message),
data: JSON.stringify(payload),
contentType: 'application/json; charset=utf-8',
dataType: 'json'
}).done(function (resp) {
@@ -468,18 +510,15 @@
var $msg = $('#matcherMsg'),
$button = $('#matchSubmit'),
$result = $('#matchResult');
if (!file) {
$msg.removeClass().addClass('form-message text-danger').text(t('cv.noFile'));
return;
}
if (!jobUrl && !jobDescription) {
$msg.removeClass().addClass('form-message text-danger').text(t('cv.noJob'));
return;
}
if (!consent) {
$msg.removeClass().addClass('form-message text-danger').text(t('cv.noConsent'));
return;
}
clearFieldErrors(['cvFileError', 'cvJobError', 'cvConsentError']);
$msg.removeClass().addClass('form-message').text('');
var hasError = false;
if (!file) { showFieldError('cvFileError', t('cv.noFile')); hasError = true; }
if (!jobUrl && !jobDescription) { showFieldError('cvJobError', t('cv.noJob')); hasError = true; }
if (!consent) { showFieldError('cvConsentError', t('cv.noConsent')); hasError = true; }
if (hasError) return;
var $cvLoader = $('#cvLoader');
$button.prop('disabled', true).text(t('cv.processing'));
$msg.removeClass().addClass('form-message').text(t('cv.extracting'));
@@ -563,25 +602,32 @@
var $msg = $('#subscribeMsg');
var $button = $('#subscribeSubmit');
var $loader = $('#contactLoader');
var email = $('#subscribeEmail').val();
var email = $('#subscribeEmail').val().trim();
var consent = $('#subscribeConsent').is(':checked');
function setMsg(severity, key) {
$msg.removeClass().addClass('form-message text-' + severity).text(t(key));
}
if (!consent) {
setMsg('danger', 'subscribe.noConsent');
return;
}
clearFieldErrors(['subscribeEmailError', 'subscribeConsentError']);
$msg.removeClass().addClass('form-message').text('');
var hasError = false;
if (!email) {
setMsg('danger', 'form.failed');
return;
showFieldError('subscribeEmailError', t('form.required.email'));
hasError = true;
} else if (!isValidEmail(email)) {
showFieldError('subscribeEmailError', t('form.required.emailInvalid'));
hasError = true;
}
if (!consent) {
showFieldError('subscribeConsentError', t('subscribe.noConsent'));
hasError = true;
}
if (hasError) return;
$loader.css('display', 'flex');
$button.prop('disabled', true);
$msg.removeClass().addClass('form-message').text('');
function postSubscribe(token) {
$.ajax({