DmitrMakeev commited on
Commit
23dd468
·
verified ·
1 Parent(s): c0ef9ce

Update pages.html

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