1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- /**
- * @api
- */
- define([
- 'jquery',
- 'underscore',
- 'jquery/ui',
- 'Magento_Ui/js/modal/confirm',
- 'mage/translate'
- ], function ($, _) {
- 'use strict';
- $.widget('mage.alert', $.mage.confirm, {
- options: {
- modalClass: 'confirm',
- title: $.mage.__('Attention'),
- actions: {
- /**
- * Callback always - called on all actions.
- */
- always: function () {}
- },
- buttons: [{
- text: $.mage.__('OK'),
- class: 'action-primary action-accept',
- /**
- * Click handler.
- */
- click: function () {
- this.closeModal(true);
- }
- }]
- },
- /**
- * Close modal window.
- */
- closeModal: function () {
- this.options.actions.always();
- this.element.bind('alertclosed', _.bind(this._remove, this));
- return this._super();
- }
- });
- return function (config) {
- return $('<div></div>').html(config.content).alert(config);
- };
- });
|