- /**
- * @param {String} widgetUrl
- */
- openDialog: function (widgetUrl) {
- var oThis = this,
- title = 'Insert Widget',
- mode = 'new',
- dialog;
-
- if (this.editMode) {
- title = 'Edit Widget';
- mode = 'edit';
- }
-
- if (this.dialogOpened) {
- return;
- }
-
- this.dialogWindow = jQuery('<div/>').modal({
-
- title: jQuery.mage.__(title),
- type: 'slide',
- buttons: [],
-
- /**
- * Opened.
- */
- opened: function () {
- dialog = jQuery(this).addClass('loading magento-message');
-
- widgetUrl += 'mode/' + mode;
-
- new Ajax.Updater($(this), widgetUrl, {
- evalScripts: true,
-
- /**
- * On complete.
- */
- onComplete: function () {
- dialog.removeClass('loading');
- }
- });
- },
-
- /**
- * @param {jQuery.Event} e
- * @param {Object} modal
- */
- closed: function (e, modal) {
- modal.modal.remove();
- oThis.dialogOpened = false;
- }
- });
-
- this.dialogOpened = true;
- this.dialogWindow.modal('openModal');
- }