Переделал кнопку отпаравки заявки

This commit is contained in:
NikDizell 2026-04-07 21:55:48 +03:00
parent 5df87f07cc
commit f22849878b
12 changed files with 385 additions and 208 deletions

View File

@ -1696,3 +1696,60 @@ body {
font-size: 1rem; font-size: 1rem;
border-radius: 8px; border-radius: 8px;
} }
.floating-btn {
position: fixed;
bottom: 30px;
right: 30px;
z-index: 10000;
animation: fadeInUp 0.5s ease;
}
.floating-btn .btn {
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
border-radius: 50px;
padding: 12px 24px;
font-size: 1.1rem;
background: #ff7300;
color: white;
border: none;
cursor: pointer;
transition: transform 0.2s;
}
.floating-btn .btn:hover {
transform: scale(1.05);
background: #0056b3;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Пульсация для кнопки */
@keyframes pulse {
0% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.7);
}
70% {
transform: scale(1.1);
box-shadow: 0 0 0 15px rgba(255, 107, 0, 0);
}
100% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 107, 0, 0);
}
}
.floating-btn .btn.pulse {
animation: pulse 1.5s infinite;
will-change: transform;
}

View File

@ -0,0 +1,63 @@
// static/programmer/js/floating-button.js
const CallbackModal = {
shown: false,
modalId: 'callbackModal',
floatingBtnId: 'floatingButton',
init() {
setTimeout(() => {
const btn = document.getElementById(this.floatingBtnId);
if (btn) {
btn.style.display = 'block';
this.shown = true;
const button = btn.querySelector('.btn');
if (button) button.classList.add('pulse');
}
}, 5000);
},
open() {
const modal = document.getElementById(this.modalId);
if (modal) {
modal.style.display = 'block';
const floatingBtn = document.getElementById(this.floatingBtnId);
if (floatingBtn && this.shown) {
floatingBtn.style.display = 'none';
}
}
},
close() {
const modal = document.getElementById(this.modalId);
if (modal) {
modal.style.display = 'none';
const floatingBtn = document.getElementById(this.floatingBtnId);
if (floatingBtn && this.shown) {
floatingBtn.style.display = 'block';
const button = floatingBtn.querySelector('.btn.pulse');
if (button) {
button.style.animation = 'none';
setTimeout(() => button.style.animation = '', 10);
}
}
}
}
};
// Инициализация и глобальные обработчики
document.addEventListener('DOMContentLoaded', () => {
CallbackModal.init();
// Закрытие по клику вне модального окна
const modal = document.getElementById(CallbackModal.modalId);
if (modal) {
modal.addEventListener('click', (event) => {
if (event.target === modal) CallbackModal.close();
});
}
// Закрытие по ESC
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape') CallbackModal.close();
});
});

View File

@ -1,74 +1,41 @@
// recall.js - Скрипты для страницы отзывов // static/programmer/js/recall.js
function openModal(imageUrl, title) { const ImageModal = {
console.log('Opening modal with:', imageUrl); modalId: 'imageModal',
const modal = document.getElementById('imageModal'); imageId: 'modalImage',
const modalImg = document.getElementById('modalImage'); titleId: 'modalTitle',
const modalTitle = document.getElementById('modalTitle');
if (modal && modalImg) { open(imageUrl, title) {
modal.style.display = "block"; const modal = document.getElementById(this.modalId);
modalImg.src = imageUrl; const img = document.getElementById(this.imageId);
if (title && modalTitle) { const titleEl = document.getElementById(this.titleId);
modalTitle.textContent = title; if (modal && img && titleEl) {
img.src = imageUrl;
img.alt = title || 'Просмотр изображения';
titleEl.textContent = title || 'Просмотр изображения';
modal.style.display = 'block';
} }
},
// Добавляем класс для анимации close() {
setTimeout(() => { const modal = document.getElementById(this.modalId);
modal.classList.add('active'); if (modal) {
}, 10); modal.style.display = 'none';
const img = document.getElementById(this.imageId);
// Подстраиваем размер изображения if (img) img.src = '';
adjustModalImageSize(); }
} }
} };
function closeModal() { // Обработчики для модального окна изображений
const modal = document.getElementById('imageModal'); document.addEventListener('DOMContentLoaded', () => {
const modal = document.getElementById(ImageModal.modalId);
if (modal) { if (modal) {
modal.classList.remove('active'); modal.addEventListener('click', (event) => {
setTimeout(() => { if (event.target === modal) ImageModal.close();
modal.style.display = "none"; });
}, 300);
} }
}
function adjustModalImageSize() { document.addEventListener('keydown', (event) => {
const modalImg = document.getElementById('modalImage'); if (event.key === 'Escape') ImageModal.close();
const modalContent = document.querySelector('.modal-content');
if (modalImg && modalContent) {
const maxWidth = window.innerWidth * 0.9;
const maxHeight = window.innerHeight * 0.8;
modalImg.style.maxWidth = `${maxWidth}px`;
modalImg.style.maxHeight = `${maxHeight}px`;
}
}
// Инициализация после загрузки DOM
document.addEventListener('DOMContentLoaded', function() {
// Закрытие модального окна при клике вне изображения
document.addEventListener('click', function(event) {
const modal = document.getElementById('imageModal');
if (event.target === modal) {
closeModal();
}
}); });
// Закрытие по ESC
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closeModal();
}
});
// Адаптация размера изображения при изменении размера окна
window.addEventListener('resize', function() {
const modalImg = document.getElementById('modalImage');
if (modalImg && modalImg.src) {
adjustModalImageSize();
}
});
console.log('Recall page scripts initialized');
}); });

View File

@ -1,4 +1,5 @@
{% extends 'programmer/base.html' %} {% extends 'programmer/base.html' %}
{% load static %}
{% load django_bootstrap5 %} {% load django_bootstrap5 %}
{% block content %} {% block content %}
@ -151,4 +152,7 @@
} }
</script> </script>
<script src="{% static 'programmer/js/floating-button.js' %}"></script>
{% endblock %} {% endblock %}

View File

@ -322,6 +322,59 @@
</div> </div>
</footer> </footer>
<!-- Модальное окно формы -->
<div id="callbackModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>📞 Заявка на консультацию</h3>
<button class="modal-close" onclick="CallbackModal.close()">&times;</button>
</div>
<div class="modal-body">
<form method="post" action="{% url 'callback' %}" id="callbackForm">
{% csrf_token %}
<div class="form-group">
<label for="id_name">Имя *</label>
{{ form.name }}
</div>
<div class="form-group">
<label for="id_phone">Телефон *</label>
{{ form.phone }}
</div>
<div class="form-group">
<label for="id_email">Электронная почта</label>
{{ form.email }}
</div>
<div class="form-group">
<label for="id_question">Ваш вопрос</label>
{{ form.question }}
</div>
{% if form.captcha %}
<div class="form-group">
<label for="id_captcha">Защитный код *</label>
{{ form.captcha }}
</div>
{% endif %}
<div class="form-actions">
<button type="submit" class="btn btn-primary" style="width: 100%;">
📨 Отправить заявку
</button>
</div>
</form>
</div>
</div>
</div>
<!-- Плавающая кнопка -->
<div id="floatingButton" class="floating-btn" style="position: fixed; bottom: 30px; right: 30px; z-index: 10000; display: none;">
<button onclick="CallbackModal.open()" class="btn btn-primary pulse">🎯 Получить консультацию</button>
</div>
{% bootstrap_javascript %} {% bootstrap_javascript %}
<script src="{% static 'programmer/js/theme-switcher.js' %}"></script> <script src="{% static 'programmer/js/theme-switcher.js' %}"></script>
<script src="{% static 'programmer/js/mobile-menu.js' %}"></script> <script src="{% static 'programmer/js/mobile-menu.js' %}"></script>

View File

@ -1,4 +1,5 @@
{% extends 'programmer/base.html' %} {% extends 'programmer/base.html' %}
{% load static %}
{% load django_bootstrap5 %} {% load django_bootstrap5 %}
{% block content %} {% block content %}
@ -17,94 +18,28 @@
<div class="card-content"> <div class="card-content">
{{p.content}} {{p.content}}
</div> </div>
<div class="card-actions"> <!-- <div class="card-actions">
<button onclick="openModal()" class="btn btn-primary">🎯 Получить консультацию</button> <button onclick="openModal()" class="btn btn-primary">🎯 Получить консультацию</button>
</div> </div> -->
</div> </div>
{% endfor %} {% endfor %}
{% endautoescape %} {% endautoescape %}
</div> </div>
<!-- Модальное окно формы -->
<div id="callbackModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>📞 Заявка на консультацию</h3>
<button class="modal-close" onclick="closeModal()">&times;</button>
</div>
<div class="modal-body">
<form method="post" action="{% url 'callback' %}" id="callbackForm">
{% csrf_token %}
<div class="form-group">
<label for="id_name">Имя *</label>
{{ form.name }}
</div>
<div class="form-group">
<label for="id_phone">Телефон *</label>
{{ form.phone }}
</div>
<div class="form-group">
<label for="id_email">Электронная почта</label>
{{ form.email }}
</div>
<div class="form-group">
<label for="id_question">Ваш вопрос</label>
{{ form.question }}
</div>
{% if form.captcha %}
<div class="form-group">
<label for="id_captcha">Защитный код *</label>
{{ form.captcha }}
</div>
{% endif %}
<div class="form-actions">
<button type="submit" class="btn btn-primary" style="width: 100%;">
📨 Отправить заявку
</button>
</div>
</form>
</div>
</div>
</div>
{% if not posts %} {% if not posts %}
<div class="modern-card text-center fade-in"> <div class="modern-card text-center fade-in">
<h3>🚀 Контент скоро появится</h3> <h3>🚀 Контент скоро появится</h3>
<p class="card-subtitle">Мы готовим для вас интересные материалы и кейсы</p> <p class="card-subtitle">Мы готовим для вас интересные материалы и кейсы</p>
<div class="card-actions justify-center"> <!-- <div class="card-actions justify-center">
<button onclick="openModal()" class="btn btn-primary">🎯 Получить консультацию</button> <button onclick="openModal()" class="btn btn-primary">🎯 Получить консультацию</button>
</div> </div> -->
</div> </div>
{% endif %} {% endif %}
<script> <script src="{% static 'programmer/js/floating-button.js' %}"></script>
function openModal() {
document.getElementById('callbackModal').style.display = 'block';
}
function closeModal() { {% block extra_js %}
document.getElementById('callbackModal').style.display = 'none';
} {% endblock %}
// Закрытие модального окна при клике вне его
window.onclick = function(event) {
const modal = document.getElementById('callbackModal');
if (event.target === modal) {
closeModal();
}
}
// Закрытие по ESC
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closeModal();
}
});
</script>
{% endblock %} {% endblock %}

View File

@ -2,6 +2,7 @@
{% load django_bootstrap5 %} {% load django_bootstrap5 %}
{% load static %} {% load static %}
{% load seo_tags %} {% load seo_tags %}
{% load programmer_tags %}
{% block extra_css %} {% block extra_css %}
<link rel="stylesheet" href="{% static 'programmer/css/recall.css' %}"> <link rel="stylesheet" href="{% static 'programmer/css/recall.css' %}">
@ -59,7 +60,7 @@
<img src="{{ p.scan.url }}" <img src="{{ p.scan.url }}"
alt="Отзыв от {{ p.title }}" alt="Отзыв от {{ p.title }}"
class="recall-scan" class="recall-scan"
onclick="openModal('{{ p.scan.url }}', '{{ p.title }}')"> onclick="ImageModal.open('{{ p.scan.url }}', '{{ p.title }}')">
<div class="scan-hint"> <div class="scan-hint">
<span class="scan-zoom-icon">🔍</span> <span class="scan-zoom-icon">🔍</span>
<span class="scan-text">Нажмите для увеличения</span> <span class="scan-text">Нажмите для увеличения</span>
@ -88,15 +89,12 @@
</div> </div>
{% endif %} {% endif %}
<!-- Скрипт для модального окна -->
<script src="{% static 'programmer/js/recall.js' %}"></script>
<!-- Модальное окно для увеличения изображений --> <!-- Модальное окно для увеличения изображений -->
<div id="imageModal" class="modal"> <div id="imageModal" class="modal">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 id="modalTitle">Просмотр изображения</h3> <h3 id="modalTitle">Просмотр изображения</h3>
<button class="modal-close" onclick="closeModal()">&times;</button> <button class="modal-close" onclick="ImageModal.close()">&times;</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<img class="modal-image" id="modalImage" alt=""> <img class="modal-image" id="modalImage" alt="">
@ -104,4 +102,12 @@
</div> </div>
</div> </div>
<script src="{% static 'programmer/js/floating-button.js' %}"></script>
<script src="{% static 'programmer/js/recall.js' %}"></script>
{% block extra_js %}
{% endblock %}
{% endblock %} {% endblock %}

View File

@ -46,7 +46,6 @@
window.totalPages = {{ paginator.num_pages }}; window.totalPages = {{ paginator.num_pages }};
</script> </script>
<script src="{% static 'programmer/js/solution-accordion.js' %}"></script>
{% endblock %} {% endblock %}
{% block extra_js %} {% block extra_js %}

View File

@ -102,8 +102,10 @@ class AboutPageView(BasePageView, BreadcrumbMixin):
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
form = CallbackForm()
context.update({ context.update({
'form': form,
'title': "Программист 1С Николай Сердюк - 10+ лет опыта | Услуги 1С", 'title': "Программист 1С Николай Сердюк - 10+ лет опыта | Услуги 1С",
'meta_description': ( 'meta_description': (
"Николай Сердюк - сертифицированный программист 1С с 10+ лет опыта. " "Николай Сердюк - сертифицированный программист 1С с 10+ лет опыта. "
@ -135,8 +137,10 @@ class SolutionListView(BaseListView, BreadcrumbMixin):
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
form = CallbackForm()
context.update({ context.update({
'form': form,
'title': "Проекты автоматизации 1С | Реализованные кейсы и решения", 'title': "Проекты автоматизации 1С | Реализованные кейсы и решения",
'meta_description': ( 'meta_description': (
"Реализованные проекты по автоматизации 1С: складской учет с ТСД, " "Реализованные проекты по автоматизации 1С: складской учет с ТСД, "
@ -167,8 +171,10 @@ class RecallListView(BaseListView, BreadcrumbMixin):
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
form = CallbackForm()
context.update({ context.update({
'form': form,
'title': "Отзывы клиентов о работе программиста 1С | Реальные кейсы", 'title': "Отзывы клиентов о работе программиста 1С | Реальные кейсы",
'meta_description': ( 'meta_description': (
"Реальные отзывы клиентов о работе программиста 1С Николая Сердюка. " "Реальные отзывы клиентов о работе программиста 1С Николая Сердюка. "

View File

@ -1696,3 +1696,60 @@ body {
font-size: 1rem; font-size: 1rem;
border-radius: 8px; border-radius: 8px;
} }
.floating-btn {
position: fixed;
bottom: 30px;
right: 30px;
z-index: 10000;
animation: fadeInUp 0.5s ease;
}
.floating-btn .btn {
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
border-radius: 50px;
padding: 12px 24px;
font-size: 1.1rem;
background: #ff7300;
color: white;
border: none;
cursor: pointer;
transition: transform 0.2s;
}
.floating-btn .btn:hover {
transform: scale(1.05);
background: #0056b3;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Пульсация для кнопки */
@keyframes pulse {
0% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.7);
}
70% {
transform: scale(1.1);
box-shadow: 0 0 0 15px rgba(255, 107, 0, 0);
}
100% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 107, 0, 0);
}
}
.floating-btn .btn.pulse {
animation: pulse 1.5s infinite;
will-change: transform;
}

View File

@ -0,0 +1,63 @@
// static/programmer/js/floating-button.js
const CallbackModal = {
shown: false,
modalId: 'callbackModal',
floatingBtnId: 'floatingButton',
init() {
setTimeout(() => {
const btn = document.getElementById(this.floatingBtnId);
if (btn) {
btn.style.display = 'block';
this.shown = true;
const button = btn.querySelector('.btn');
if (button) button.classList.add('pulse');
}
}, 5000);
},
open() {
const modal = document.getElementById(this.modalId);
if (modal) {
modal.style.display = 'block';
const floatingBtn = document.getElementById(this.floatingBtnId);
if (floatingBtn && this.shown) {
floatingBtn.style.display = 'none';
}
}
},
close() {
const modal = document.getElementById(this.modalId);
if (modal) {
modal.style.display = 'none';
const floatingBtn = document.getElementById(this.floatingBtnId);
if (floatingBtn && this.shown) {
floatingBtn.style.display = 'block';
const button = floatingBtn.querySelector('.btn.pulse');
if (button) {
button.style.animation = 'none';
setTimeout(() => button.style.animation = '', 10);
}
}
}
}
};
// Инициализация и глобальные обработчики
document.addEventListener('DOMContentLoaded', () => {
CallbackModal.init();
// Закрытие по клику вне модального окна
const modal = document.getElementById(CallbackModal.modalId);
if (modal) {
modal.addEventListener('click', (event) => {
if (event.target === modal) CallbackModal.close();
});
}
// Закрытие по ESC
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape') CallbackModal.close();
});
});

View File

@ -1,74 +1,41 @@
// recall.js - Скрипты для страницы отзывов // static/programmer/js/recall.js
function openModal(imageUrl, title) { const ImageModal = {
console.log('Opening modal with:', imageUrl); modalId: 'imageModal',
const modal = document.getElementById('imageModal'); imageId: 'modalImage',
const modalImg = document.getElementById('modalImage'); titleId: 'modalTitle',
const modalTitle = document.getElementById('modalTitle');
if (modal && modalImg) { open(imageUrl, title) {
modal.style.display = "block"; const modal = document.getElementById(this.modalId);
modalImg.src = imageUrl; const img = document.getElementById(this.imageId);
if (title && modalTitle) { const titleEl = document.getElementById(this.titleId);
modalTitle.textContent = title; if (modal && img && titleEl) {
img.src = imageUrl;
img.alt = title || 'Просмотр изображения';
titleEl.textContent = title || 'Просмотр изображения';
modal.style.display = 'block';
} }
},
// Добавляем класс для анимации close() {
setTimeout(() => { const modal = document.getElementById(this.modalId);
modal.classList.add('active'); if (modal) {
}, 10); modal.style.display = 'none';
const img = document.getElementById(this.imageId);
// Подстраиваем размер изображения if (img) img.src = '';
adjustModalImageSize(); }
} }
} };
function closeModal() { // Обработчики для модального окна изображений
const modal = document.getElementById('imageModal'); document.addEventListener('DOMContentLoaded', () => {
const modal = document.getElementById(ImageModal.modalId);
if (modal) { if (modal) {
modal.classList.remove('active'); modal.addEventListener('click', (event) => {
setTimeout(() => { if (event.target === modal) ImageModal.close();
modal.style.display = "none"; });
}, 300);
} }
}
function adjustModalImageSize() { document.addEventListener('keydown', (event) => {
const modalImg = document.getElementById('modalImage'); if (event.key === 'Escape') ImageModal.close();
const modalContent = document.querySelector('.modal-content');
if (modalImg && modalContent) {
const maxWidth = window.innerWidth * 0.9;
const maxHeight = window.innerHeight * 0.8;
modalImg.style.maxWidth = `${maxWidth}px`;
modalImg.style.maxHeight = `${maxHeight}px`;
}
}
// Инициализация после загрузки DOM
document.addEventListener('DOMContentLoaded', function() {
// Закрытие модального окна при клике вне изображения
document.addEventListener('click', function(event) {
const modal = document.getElementById('imageModal');
if (event.target === modal) {
closeModal();
}
}); });
// Закрытие по ESC
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closeModal();
}
});
// Адаптация размера изображения при изменении размера окна
window.addEventListener('resize', function() {
const modalImg = document.getElementById('modalImage');
if (modalImg && modalImg.src) {
adjustModalImageSize();
}
});
console.log('Recall page scripts initialized');
}); });