DmitrMakeev
commited on
Update pages.html
Browse files- pages.html +178 -71
pages.html
CHANGED
@@ -463,93 +463,200 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
463 |
</script>
|
464 |
|
465 |
<script>
|
466 |
-
// Создаем
|
467 |
-
editor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
model: {
|
469 |
defaults: {
|
470 |
-
// HTML-код формы
|
471 |
-
content: `
|
472 |
-
<div class="container">
|
473 |
-
<form id="contactForm">
|
474 |
-
<h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
|
475 |
-
<div class="form-group">
|
476 |
-
<label for="name">Имя</label>
|
477 |
-
<input type="text" id="name" required>
|
478 |
-
</div>
|
479 |
-
<div class="form-group">
|
480 |
-
<label for="email">Почта</label>
|
481 |
-
<input type="email" id="email" required>
|
482 |
-
</div>
|
483 |
-
<div class="form-group">
|
484 |
-
<label for="phone">Телефон</label>
|
485 |
-
<input type="tel" id="phone" required>
|
486 |
-
</div>
|
487 |
-
<div class="form-group">
|
488 |
-
<label for="options">Выберите тариф</label>
|
489 |
-
<select id="options" 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">
|
497 |
-
<input type="checkbox" id="newsletter" required>
|
498 |
-
<label for="newsletter">Согласие на email рассылку</label>
|
499 |
-
</div>
|
500 |
-
<div class="form-group">
|
501 |
-
<a href="#" id="privacyPolicyLink">Политика конфиденциальности</a>
|
502 |
-
</div>
|
503 |
-
<button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
|
504 |
-
</form>
|
505 |
-
</div>
|
506 |
-
`,
|
507 |
-
// Скрипт для обработки отправки формы
|
508 |
script: function(props) {
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
}
|
522 |
},
|
523 |
-
// Свойства, которые будут передаваться в скрипт
|
524 |
-
'script-props': ['avp', 'grup', 'red_url'],
|
525 |
-
// Настройки для изменения URL отправки
|
526 |
traits: [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
{
|
528 |
type: 'text',
|
529 |
name: 'avp',
|
530 |
label: 'AVP',
|
531 |
-
changeProp: true
|
532 |
},
|
533 |
{
|
534 |
type: 'text',
|
535 |
-
name: '
|
536 |
-
label: '
|
537 |
-
changeProp: true
|
538 |
},
|
539 |
{
|
540 |
type: 'text',
|
541 |
-
name: '
|
542 |
-
label: '
|
543 |
-
changeProp: true
|
544 |
-
}
|
545 |
-
]
|
546 |
-
}
|
547 |
-
|
|
|
548 |
});
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
});
|
554 |
|
555 |
|
|
|
463 |
</script>
|
464 |
|
465 |
<script>
|
466 |
+
// Создаем блок формы
|
467 |
+
editor.Blocks.add('custom-form', {
|
468 |
+
label: 'Custom Form',
|
469 |
+
content: `
|
470 |
+
<div class="form-container container">
|
471 |
+
<form id="contactForm">
|
472 |
+
<h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
|
473 |
+
<div class="form-group name-field"></div>
|
474 |
+
<div class="form-group email-field"></div>
|
475 |
+
<div class="form-group phone-field"></div>
|
476 |
+
<div class="form-group options-field"></div>
|
477 |
+
<div class="form-check newsletter-field"></div>
|
478 |
+
<div class="form-group privacy-policy-link"></div>
|
479 |
+
<div class="form-group submit-button"></div>
|
480 |
+
</form>
|
481 |
+
</div>
|
482 |
+
`,
|
483 |
+
});
|
484 |
+
|
485 |
+
// Добавляем возможность настройки каждого элемента формы
|
486 |
+
editor.DomComponents.addType('form-input', {
|
487 |
+
model: {
|
488 |
+
defaults: {
|
489 |
+
script: function() {
|
490 |
+
console.log('Form input initialized with placeholder: ', this.getAttribute('placeholder'));
|
491 |
+
},
|
492 |
+
traits: [
|
493 |
+
{
|
494 |
+
type: 'text',
|
495 |
+
name: 'id',
|
496 |
+
label: 'Id',
|
497 |
+
changeProp: true,
|
498 |
+
},
|
499 |
+
{
|
500 |
+
type: 'text',
|
501 |
+
name: 'placeholder',
|
502 |
+
label: 'Placeholder',
|
503 |
+
changeProp: true,
|
504 |
+
},
|
505 |
+
{
|
506 |
+
type: 'checkbox',
|
507 |
+
name: 'required',
|
508 |
+
label: 'Required',
|
509 |
+
changeProp: true,
|
510 |
+
},
|
511 |
+
],
|
512 |
+
},
|
513 |
+
'script-props': ['id', 'placeholder', 'required'],
|
514 |
+
},
|
515 |
+
});
|
516 |
+
|
517 |
+
editor.DomComponents.addType('form-select', {
|
518 |
+
model: {
|
519 |
+
defaults: {
|
520 |
+
script: function() {
|
521 |
+
console.log('Form select initialized with options: ', this.options);
|
522 |
+
},
|
523 |
+
traits: [
|
524 |
+
{
|
525 |
+
type: 'text',
|
526 |
+
name: 'id',
|
527 |
+
label: 'Id',
|
528 |
+
changeProp: true,
|
529 |
+
},
|
530 |
+
{
|
531 |
+
type: 'text',
|
532 |
+
name: 'options',
|
533 |
+
label: 'Options',
|
534 |
+
changeProp: true,
|
535 |
+
},
|
536 |
+
{
|
537 |
+
type: 'checkbox',
|
538 |
+
name: 'required',
|
539 |
+
label: 'Required',
|
540 |
+
changeProp: true,
|
541 |
+
},
|
542 |
+
],
|
543 |
+
},
|
544 |
+
'script-props': ['id', 'options', 'required'],
|
545 |
+
},
|
546 |
+
});
|
547 |
+
|
548 |
+
editor.DomComponents.addType('form-checkbox', {
|
549 |
+
model: {
|
550 |
+
defaults: {
|
551 |
+
script: function() {
|
552 |
+
console.log('Form checkbox initialized. Required: ', this.getAttribute('required'));
|
553 |
+
},
|
554 |
+
traits: [
|
555 |
+
{
|
556 |
+
type: 'text',
|
557 |
+
name: 'id',
|
558 |
+
label: 'Id',
|
559 |
+
changeProp: true,
|
560 |
+
},
|
561 |
+
{
|
562 |
+
type: 'checkbox',
|
563 |
+
name: 'required',
|
564 |
+
label: 'Required',
|
565 |
+
changeProp: true,
|
566 |
+
},
|
567 |
+
],
|
568 |
+
},
|
569 |
+
'script-props': ['id', 'required'],
|
570 |
+
},
|
571 |
+
});
|
572 |
+
|
573 |
+
editor.DomComponents.addType('form-button', {
|
574 |
model: {
|
575 |
defaults: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
script: function(props) {
|
577 |
+
console.log('Form button initialized with text: ', props.text);
|
578 |
+
console.log('AVP: ', props.avp);
|
579 |
+
console.log('GRUPS: ', props.grups);
|
580 |
+
console.log('REDIRECT: ', props.redirect);
|
581 |
+
|
582 |
+
// Пример использования переменной redirect для перенаправления пользователя при отправке формы
|
583 |
+
this.addEventListener('click', function(event) {
|
584 |
+
event.preventDefault();
|
585 |
+
if (props.redirect) {
|
586 |
+
window.location.href = props.redirect;
|
587 |
+
}
|
588 |
+
});
|
|
|
589 |
},
|
|
|
|
|
|
|
590 |
traits: [
|
591 |
+
{
|
592 |
+
type: 'text',
|
593 |
+
name: 'id',
|
594 |
+
label: 'Id',
|
595 |
+
changeProp: true,
|
596 |
+
},
|
597 |
+
{
|
598 |
+
type: 'text',
|
599 |
+
name: 'text',
|
600 |
+
label: 'Button Text',
|
601 |
+
changeProp: true,
|
602 |
+
},
|
603 |
{
|
604 |
type: 'text',
|
605 |
name: 'avp',
|
606 |
label: 'AVP',
|
607 |
+
changeProp: true,
|
608 |
},
|
609 |
{
|
610 |
type: 'text',
|
611 |
+
name: 'grups',
|
612 |
+
label: 'GRUPS',
|
613 |
+
changeProp: true,
|
614 |
},
|
615 |
{
|
616 |
type: 'text',
|
617 |
+
name: 'redirect',
|
618 |
+
label: 'Redirect',
|
619 |
+
changeProp: true,
|
620 |
+
},
|
621 |
+
],
|
622 |
+
},
|
623 |
+
'script-props': ['id', 'text', 'avp', 'grups', 'redirect'],
|
624 |
+
},
|
625 |
});
|
626 |
+
|
627 |
+
// Добавляем возможность настройки ссылки "Политика конфиденциальности"
|
628 |
+
editor.DomComponents.addType('privacy-policy-link', {
|
629 |
+
model: {
|
630 |
+
defaults: {
|
631 |
+
script: function(props) {
|
632 |
+
const link = this;
|
633 |
+
link.href = props.href || '#';
|
634 |
+
link.target = props.newWindow ? '_blank' : '_self';
|
635 |
+
console.log('Privacy policy link initialized with href: ', props.href);
|
636 |
+
},
|
637 |
+
traits: [
|
638 |
+
{
|
639 |
+
type: 'text',
|
640 |
+
name: 'id',
|
641 |
+
label: 'Id',
|
642 |
+
changeProp: true,
|
643 |
+
},
|
644 |
+
{
|
645 |
+
type: 'text',
|
646 |
+
name: 'href',
|
647 |
+
label: 'Link URL',
|
648 |
+
changeProp: true,
|
649 |
+
},
|
650 |
+
{
|
651 |
+
type: 'checkbox',
|
652 |
+
name: 'newWindow',
|
653 |
+
label: 'Open in new window',
|
654 |
+
changeProp: true,
|
655 |
+
},
|
656 |
+
],
|
657 |
+
},
|
658 |
+
'script-props': ['id', 'href', 'newWindow'],
|
659 |
+
},
|
660 |
});
|
661 |
|
662 |
|