ofite/app/templates/base.html

318 lines
15 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% load static_with_versioning %}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="Автоматизация промышленных процессов.">
<meta name="keywords" content="МФСБ, АСУТП, автоматизация, машинное обучение, разработка ПО">
<link rel="canonical" href="https://cybercode.pro/"/>
<meta name="robots" content="index, follow"/>
<link type="image/x-icon" href="{% static_with_version 'cybercode/img/logo.png' %}" rel="shortcut icon">
<link type="Image/x-icon" href="{% static_with_version 'cybercode/img/logo.png' %}" rel="icon">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous" referrerpolicy="no-referrer"/>
<link rel="stylesheet" href="{% static_with_version 'swiper/swiper.css' %}"/>
<link href="{% static_with_version 'bootstrap/bootstrap.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{% static_with_version 'cybercode/styles/fonts/fonts.css' %}">
<link rel="stylesheet" href="{% static_with_version 'cybercode/styles/style.css' %}">
<link rel="stylesheet" href="{% static_with_version 'cybercode/styles/editor.css' %}">
{% block title %}
<title>Кибекод</title>
{% endblock %}
{% if is_prod %}
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (m, e, t, r, i, k, a) {
m[i] = m[i] || function () {
(m[i].a = m[i].a || []).push(arguments)
};
m[i].l = 1 * new Date();
for (var j = 0; j < document.scripts.length; j++) {
if (document.scripts[j].src === r) {
return;
}
}
k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(k, a)
})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(98625119, "init", {
clickmap: true,
trackLinks: true,
accurateTrackBounce: true
});
</script>
<noscript>
<div><img src="https://mc.yandex.ru/watch/98625119" style="position:absolute; left:-9999px;" alt=""/></div>
</noscript>
<!-- /Yandex.Metrika counter -->
{% endif %}
</head>
<body>
{% if is_prod %}
<style>
.watermark {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999; /* Водяной знак выше фона */
display: flex;
justify-content: center;
align-items: center;
pointer-events: none; /* Чтобы не мешал взаимодействию */
opacity: 0.5; /* Полупрозрачность */
font-size: 5rem;
color: white;
transform: rotate(-45deg);
white-space: nowrap;
}
</style>
{% endif %}
{% if watermark %}
<div class="watermark" style="background: none;">Сайт находится в разработке</div>
{% endif %}
{% block header %}
<header class="header">
<div class="container">
<div class="header-content">
<a class="logo white-link-underline cursor-pointer" href="javascript:void(0);"
id="mainLink">КиберКод</a>
<nav>
<ul class="nav-list">
<li class="nav-item cursor-pointer">
<a id="projects" href="javascript:void(0);"
class="nav-link white-link-underline">Проекты</a>
</li>
<li class="nav-item cursor-pointer">
<a id="services" href="javascript:void(0);" class="nav-link white-link-underline">Услуги</a>
</li>
<li class="nav-item cursor-pointer">
<a id="about" href="javascript:void(0);" class="nav-link white-link-underline">О
компании</a>
</li>
<li class="nav-item cursor-pointer">
<a id="contacts" href="javascript:void(0);"
class="nav-link white-link-underline">Контакты</a>
</li>
</ul>
</nav>
<div class="burger">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</header>
{% endblock %}
{% block content %}{% endblock %}
{% block modal %}
{% if is_feedback_working %}
<a class="cursor-pointer"
style="fill: #fff; position: fixed; bottom: 5vh; right: 5vw; z-index:1; width: 50px; height: 50px;"
data-bs-toggle="modal" data-bs-target="#feedbackModal">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="message">
<g>
<g>
<circle cx="12" cy="12" r="1"/>
<circle cx="16" cy="12" r="1"/>
<circle cx="8" cy="12" r="1"/>
<path d="M19.07 4.93a10 10 0 0 0-16.28 11 1.06 1.06 0 0 1 .09.64L2 20.8a1 1 0 0 0 .27.91A1 1 0 0 0 3 22h.2l4.28-.86a1.26 1.26 0 0 1 .64.09 10 10 0 0 0 11-16.28zm.83 8.36a8 8 0 0 1-11 6.08 3.26 3.26 0 0 0-1.25-.26 3.43 3.43 0 0 0-.56.05l-2.82.57.57-2.82a3.09 3.09 0 0 0-.21-1.81 8 8 0 0 1 6.08-11 8 8 0 0 1 9.19 9.19z"/>
</g>
</g>
</svg>
</a>
<div class="modal fade" id="feedbackModal" tabindex="-1" aria-labelledby="feedbackModalLabel" aria-hidden="true"
data-bs-theme="dark">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="feedbackModalLabel" style="color: #fff;">Связаться с нами</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<form id="feedbackForm" novalidate>
<div class="mb-3" id="messageBox"></div>
<div class="mb-3">
<label for="nameInput" class="form-label" style="color: #fff;">Ваше имя</label>
<input type="text" class="form-control" id="nameInput" placeholder="Введите ваше имя">
</div>
<div class="mb-3">
<label for="emailInput" class="form-label" style="color: #fff;">Email</label>
<input type="email" class="form-control" id="emailInput"
placeholder="Введите ваш email">
</div>
<div class="mb-3">
<label for="orgInput" class="form-label" style="color: #fff;">Организация</label>
<input type="text" class="form-control" id="orgInput"
placeholder="Введите наименование организации">
</div>
<div class="mb-3">
<label for="messageInput" class="form-label" style="color: #fff;">Сообщение</label>
<textarea class="form-control" id="messageInput" rows="4"
placeholder="Ваше сообщение"></textarea>
</div>
<div class="mb-3 d-flex gap-3">
<input type="checkbox" class="form-check-input large" name="agree" id="agreeInput">
<label for="agreeInput" style="color: #fff;"><a href="#" style="color: #ffff;">Согласие
на
обработку персональных данных</a></label>
</div>
<button type="submit" class="btn btn-lg w-100">Отправить</button>
</form>
</div>
</div>
</div>
</div>
<script>
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
function validateName(DOMElement) {
if (DOMElement.value.length <= 2) {
messageBox.appendChild(createAlertElement('Ваше имя слишком короткое'))
return false
}
return true
}
function validateEmail(DOMElement) {
if (!Boolean(DOMElement.value.match(
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
))) {
messageBox.appendChild(createAlertElement('Ваш адрес электронной почты не прошел проверку'));
return false
}
return true
}
function validateOrg(DOMElement) {
if (DOMElement.value.length <= 2) {
messageBox.appendChild(createAlertElement('Имя Вашей организации слишком короткое'));
return false
}
return true
}
function validateMessage(DOMElement) {
if (DOMElement.value.length <= 10) {
messageBox.appendChild(createAlertElement('Сообщение слишком короткое'))
return false
}
return true
}
function validateAgree(DOMElement) {
if (!DOMElement.checked) {
messageBox.appendChild(createAlertElement('Вы не подтвердили согласие на обработку персональных данных'))
return false
}
return true
}
function createAlertElement(message, status = 'danger') {
const alertBody = document.createElement('div')
alertBody.classList.add('alert', `alert-${status}`)
alertBody.attributes.role = 'alert'
alertBody.textContent = message
return alertBody
}
const feedbackForm = document.querySelector('#feedbackForm')
const messageBox = document.querySelector('#messageBox')
feedbackForm.addEventListener('submit', async (e) => {
e.preventDefault()
messageBox.innerHTML = ''
const nameInput = document.querySelector('#nameInput');
const emailInput = document.querySelector('#emailInput');
const orgInput = document.querySelector('#orgInput');
const messageInput = document.querySelector('#messageInput');
const agreeInput = document.querySelector('#agreeInput');
const validatedName = validateName(nameInput);
const validatedEmail = validateEmail(emailInput);
const validatedOrg = validateOrg(orgInput);
const validatedMessage = validateMessage(messageInput);
const validatedAgree = validateAgree(agreeInput);
if (validatedName && validatedEmail && validatedOrg && validatedMessage && validatedAgree) {
const response = await fetch('feedback/', {
method: 'POST',
headers: {
'X-CSRFToken': getCookie('csrftoken'),
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: nameInput.value,
email: emailInput.value,
org: orgInput.value,
message: messageInput.value,
})
});
const json = await response.json();
if (json.message === 'success') {
nameInput.value = '';
emailInput.value = '';
orgInput.value = '';
messageInput.value = '';
agreeInput.value = '';
messageBox.appendChild(createAlertElement('Сообщение отправлено!', "success"));
} else {
Object.keys(json.errors).forEach(errorField => {
messageBox.appendChild(createAlertElement(json.errors[errorField]));
});
}
}
})
</script>
{% endif %}
{% endblock %}
<script src="{% static_with_version 'bootstrap/bootstrap.js' %}"></script>
<script src="{% static_with_version 'bootstrap/popper.js' %}"></script>
<script src="{% static_with_version 'cybercode/js/burger.js' %}"></script>
{% block script %}{% endblock %}
<script>
function navigateToSlide(targetSlide) {
const swiperContainer = document.querySelector('.swiper-container');
// Если Swiper есть на странице
if (swiperContainer && typeof Swiper !== 'undefined') {
if (window.swiper) {
window.swiper.slideTo(targetSlide, 800);
} else {
console.error('Swiper не инициализирован.');
}
} else {
localStorage.setItem('targetSlide', targetSlide);
window.location.href = '/';
}
}
const projectBtnElem = document.querySelector('#projectBtn')
if (projectBtnElem) {
projectBtnElem.addEventListener('click', () => navigateToSlide(1));
}
document.querySelector('#mainLink').addEventListener('click', () => navigateToSlide(0));
document.querySelector('#projects').addEventListener('click', () => navigateToSlide(1));
document.querySelector('#services').addEventListener('click', () => navigateToSlide(2));
document.querySelector('#about').addEventListener('click', () => navigateToSlide(3));
document.querySelector('#contacts').addEventListener('click', () => navigateToSlide(4));
</script>
</body>
</html>