DmitrMakeev
commited on
Update pages.html
Browse files- pages.html +48 -54
pages.html
CHANGED
@@ -463,48 +463,51 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
463 |
</script>
|
464 |
|
465 |
<script>
|
466 |
-
// Создаем блок формы
|
467 |
editor.Blocks.add('custom-form', {
|
468 |
label: 'Custom Form',
|
469 |
-
content:
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
<
|
474 |
-
<
|
475 |
-
<
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
<
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
<
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
<
|
488 |
-
<
|
489 |
-
<
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
<
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
|
|
|
|
|
|
505 |
});
|
506 |
|
507 |
-
//
|
508 |
editor.DomComponents.addType('form-input', {
|
509 |
model: {
|
510 |
defaults: {
|
@@ -571,7 +574,7 @@ editor.DomComponents.addType('form-button', {
|
|
571 |
},
|
572 |
});
|
573 |
|
574 |
-
//
|
575 |
editor.DomComponents.addType('privacy-policy-link', {
|
576 |
model: {
|
577 |
defaults: {
|
@@ -591,7 +594,7 @@ editor.DomComponents.addType('privacy-policy-link', {
|
|
591 |
},
|
592 |
});
|
593 |
|
594 |
-
//
|
595 |
editor.DomComponents.addType('custom-form', {
|
596 |
model: {
|
597 |
defaults: {
|
@@ -616,7 +619,7 @@ editor.DomComponents.addType('custom-form', {
|
|
616 |
},
|
617 |
});
|
618 |
|
619 |
-
//
|
620 |
editor.on('component:update', function(component) {
|
621 |
if (component.get('type') === 'privacy-policy-link') {
|
622 |
const href = component.get('attributes').href;
|
@@ -628,24 +631,15 @@ editor.on('component:update', function(component) {
|
|
628 |
const avp = component.get('attributes').avp || '';
|
629 |
const grups = component.get('attributes').grups || '';
|
630 |
const redirect = component.get('attributes').redirect || '';
|
631 |
-
|
632 |
-
// Используем переменные в JavaScript
|
633 |
-
console.log('AVP:', avp);
|
634 |
-
console.log('GRUPS:', grups);
|
635 |
-
console.log('REDIRECT:', redirect);
|
636 |
-
|
637 |
-
// Пример использования переменных
|
638 |
const form = document.getElementById('contactForm');
|
639 |
-
form.
|
640 |
-
|
641 |
-
|
642 |
-
window.location.href = redirect;
|
643 |
-
}
|
644 |
-
});
|
645 |
}
|
646 |
});
|
647 |
|
648 |
|
|
|
649 |
|
650 |
// Добавление кнопки для открытия редактора кода
|
651 |
const pn = editor.Panels;
|
|
|
463 |
</script>
|
464 |
|
465 |
<script>
|
466 |
+
// Создаем кастомный блок формы
|
467 |
editor.Blocks.add('custom-form', {
|
468 |
label: 'Custom Form',
|
469 |
+
content: {
|
470 |
+
type: 'custom-form', // Используем тип компонента 'custom-form'
|
471 |
+
components: `
|
472 |
+
<div class="form-container container">
|
473 |
+
<form id="contactForm" class="conForm" data-avp="" data-grups="" data-redirect="">
|
474 |
+
<h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
|
475 |
+
<div class="form-group name-field">
|
476 |
+
<label for="name">Имя</label>
|
477 |
+
<input type="text" id="name" class="name" data-gjs-type="form-input" required>
|
478 |
+
</div>
|
479 |
+
<div class="form-group email-field">
|
480 |
+
<label for="email">Почта</label>
|
481 |
+
<input type="email" id="email" class="email" data-gjs-type="form-input" required>
|
482 |
+
</div>
|
483 |
+
<div class="form-group phone-field">
|
484 |
+
<label for="phone">Телефон</label>
|
485 |
+
<input type="tel" id="phone" class="phone" data-gjs-type="form-input" required>
|
486 |
+
</div>
|
487 |
+
<div class="form-group options-field">
|
488 |
+
<label for="options">Выберите тариф</label>
|
489 |
+
<select id="options" class="options" data-gjs-type="form-select" required>
|
490 |
+
<option value="" disabled selected>Тариф</option>
|
491 |
+
<option>БИЗНЕС - 69 970р.</option>
|
492 |
+
<option>PREMIUM - 89 970р.</option>
|
493 |
+
<option>VIP - 149 990р.</option>
|
494 |
+
</select>
|
495 |
+
</div>
|
496 |
+
<div class="form-check newsletter-field">
|
497 |
+
<input type="checkbox" id="newsletter" class="newsletter" data-gjs-type="form-checkbox" required>
|
498 |
+
<label for="newsletter">Согласие на email рассылку</label>
|
499 |
+
</div>
|
500 |
+
<div class="form-group privacy-policy-link">
|
501 |
+
<a href="#" id="privacyPolicyLink" class="privacyPolicyLink" data-gjs-type="privacy-policy-link">Политика конфиденциальности</a>
|
502 |
+
</div>
|
503 |
+
<button type="submit" id="submit-button" class="btn-primary submit-button" data-gjs-type="form-button">ПЕРЕЙТИ К ОПЛАТЕ</button>
|
504 |
+
</form>
|
505 |
+
</div>
|
506 |
+
`,
|
507 |
+
}
|
508 |
});
|
509 |
|
510 |
+
// Настройки для элементов формы
|
511 |
editor.DomComponents.addType('form-input', {
|
512 |
model: {
|
513 |
defaults: {
|
|
|
574 |
},
|
575 |
});
|
576 |
|
577 |
+
// Настройки для ссылки "Политика конфиденциальности"
|
578 |
editor.DomComponents.addType('privacy-policy-link', {
|
579 |
model: {
|
580 |
defaults: {
|
|
|
594 |
},
|
595 |
});
|
596 |
|
597 |
+
// Настройки для кастомной формы
|
598 |
editor.DomComponents.addType('custom-form', {
|
599 |
model: {
|
600 |
defaults: {
|
|
|
619 |
},
|
620 |
});
|
621 |
|
622 |
+
// Скрипт для обновления элементов при изменении атрибутов
|
623 |
editor.on('component:update', function(component) {
|
624 |
if (component.get('type') === 'privacy-policy-link') {
|
625 |
const href = component.get('attributes').href;
|
|
|
631 |
const avp = component.get('attributes').avp || '';
|
632 |
const grups = component.get('attributes').grups || '';
|
633 |
const redirect = component.get('attributes').redirect || '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
const form = document.getElementById('contactForm');
|
635 |
+
form.setAttribute('data-avp', avp);
|
636 |
+
form.setAttribute('data-grups', grups);
|
637 |
+
form.setAttribute('data-redirect', redirect);
|
|
|
|
|
|
|
638 |
}
|
639 |
});
|
640 |
|
641 |
|
642 |
+
|
643 |
|
644 |
// Добавление кнопки для открытия редактора кода
|
645 |
const pn = editor.Panels;
|