Commit 2f7b250e authored by Vinicius Costa's avatar Vinicius Costa Committed by De Araujo, Renato [CONBR Non-J&J]
Browse files

Issue #3313638 by viniciuscosta, RenatoG, juancec: Create Support to work with Bootstrap 5

parent 7b26e431
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
verify_load_bootstrap_automatically: true
load_bootstrap: false
bootstrap_version: '3x'
allowed_tags: 'h1,h2,a,b,big,code,del,em,i,ins,pre,q,small,span,strong,sub,sup,tt,ol,ul,li,p,br,img'
clear_caches_on_modal_save: false
default_cookie_expiration: 10000
+3 −0
Original line number Diff line number Diff line
@@ -153,6 +153,9 @@ modal_page.settings:
    load_bootstrap:
      type: boolean
      label: 'Load bootstrap'
    bootstrap_version:
      type: string
      label: 'Bootstrap version'
    allowed_tags:
      type: string
      label: 'Allowed tags'
+14 −2
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ fieldset[disabled] a.btn {
  text-shadow: 0 1px 0 #fff;
  filter: alpha(opacity=20);
  opacity: .2;
  order: 2;
}
.close:hover,
.close:focus {
@@ -148,7 +149,8 @@ button.close {
  -o-transform: translate(0, -25%);
  transform: translate(0, -25%);
}
.modal.in .modal-dialog {
.modal.in .modal-dialog,
.modal.show .modal-dialog {
  -webkit-transform: translate(0, 0);
  -ms-transform: translate(0, 0);
  -o-transform: translate(0, 0);
@@ -208,9 +210,12 @@ button.close {
  padding: 15px;
}
.modal-footer {
  display: flex;
  padding: 15px;
  text-align: left;
  border-top: 1px solid #e5e5e5;
  justify-content: space-between;
  align-items: center;
}
.modal-footer .btn + .btn {
  margin-bottom: 0;
@@ -250,7 +255,6 @@ button.close {

.modal-footer:after {
  display: table;
  content: " ";
}
.modal-header:after,
.modal-footer:after {
@@ -261,3 +265,11 @@ button.close {
.modal-no-border {
  border: none;
}
em.placeholder {
  display: unset;
  min-height: unset;
  vertical-align: unset;
  cursor: unset;
  background-color: unset;
  opacity: unset;
}
+18 −5
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
      }

      // If Bootstrap is automatic enable it only if its necessary.
      if (!$.fn.modal && verify_load_bootstrap_automatically) {
      if (!$.fn.modal && !window.bootstrap && verify_load_bootstrap_automatically) {
        $.ajax({url: "/modal-page/ajax/enable-bootstrap", success: function(result){
          location.reload();
        }});
@@ -143,14 +143,22 @@
            var delay = $(modal).find('#delay_display').val() * 1000;

            setTimeout(function () {
              if (drupalSettings.modal_page.bootstrap_version == "3x") {
                modal.modal();
              } else {
                modal.modal('show');
              }
            }, delay);
          }
        }

        // Open Modal Page clicking on "open-modal-page" class.
        $('.open-modal-page', modal).on('click', function () {
          if (drupalSettings.modal_page.bootstrap_version == "3x") {
            modal.modal();
          } else {
            modal.modal('show');
          }
        });

        // Open Modal Page clicking on user custom element.
@@ -159,7 +167,11 @@
          var link_open_modal = modal.data('modal-options').open_modal_on_element_click;

          $(link_open_modal).on('click', function () {
            if (drupalSettings.modal_page.bootstrap_version == "3x") {
              modal.modal();
            } else {
              modal.modal('show');
            }
          });
        }

@@ -184,6 +196,8 @@

          }

          modal.modal('hide');

          var modalElement = $('.js-modal-page-ok-button').parents('#js-modal-page-show-modal');

          // URL to send data.
@@ -218,7 +232,6 @@
          }

        });

      });
    }
  };
+12 −0
Original line number Diff line number Diff line
@@ -657,6 +657,18 @@ function modal_page_update_400013() {
  }
}

/**
 * Update the bootstrap version configuration with default value.
 */
function modal_page_update_500001() {

  $config = \Drupal::configFactory()->getEditable('modal_page.settings');

  $config->set('bootstrap_version', '3x');

  $config->save();
}

// -----------------------------------------------------------------------------
// Auxiliar Methods. @codingStandardsIgnoreLine
// -----------------------------------------------------------------------------
Loading