agreements-modal.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery',
  7. 'Magento_Ui/js/modal/modal',
  8. 'mage/translate'
  9. ], function ($, modal, $t) {
  10. 'use strict';
  11. return {
  12. modalWindow: null,
  13. /**
  14. * Create popUp window for provided element.
  15. *
  16. * @param {HTMLElement} element
  17. */
  18. createModal: function (element) {
  19. var options;
  20. this.modalWindow = element;
  21. options = {
  22. 'type': 'popup',
  23. 'modalClass': 'agreements-modal',
  24. 'responsive': true,
  25. 'innerScroll': true,
  26. 'trigger': '.show-modal',
  27. 'buttons': [
  28. {
  29. text: $t('Close'),
  30. class: 'action secondary action-hide-popup',
  31. /** @inheritdoc */
  32. click: function () {
  33. this.closeModal();
  34. }
  35. }
  36. ]
  37. };
  38. modal(options, $(this.modalWindow));
  39. },
  40. /** Show login popup window */
  41. showModal: function () {
  42. $(this.modalWindow).modal('openModal');
  43. }
  44. };
  45. });