Fixed two `Ajax` related issues in `UI/Dialog`
authorAlexander Ebert <ebert@woltlab.com>
Sat, 20 Jun 2015 10:03:06 +0000 (12:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 20 Jun 2015 10:03:06 +0000 (12:03 +0200)
wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js

index c43a83d4c3f783eaf911dadb55019ce1a5a2a890..aafaf56fb98495cd91e35bf74f41914100cc930c 100644 (file)
@@ -35,6 +35,9 @@ define(
                 * Sets up global container and internal variables.
                 */
                setup: function() {
+                       // Fetch Ajax, as it cannot be provided because of a circular dependency
+                       if (Ajax === undefined) Ajax = require('Ajax');
+                       
                        _container = document.createElement('div');
                        _container.classList.add('dialogOverlay');
                        _container.setAttribute('aria-hidden', 'true');
@@ -107,9 +110,7 @@ define(
                                setupData.source();
                        }
                        else if (Core.isPlainObject(setupData.source)) {
-                               Ajax.api(this, {
-                                       data: setupData.source.data
-                               }, (function(data) {
+                               Ajax.api(this, setupData.source.data, (function(data) {
                                        if (data.returnValues && typeof data.returnValues.template === 'string') {
                                                this.open(callbackObject, data.returnValues.template);
                                                
@@ -492,6 +493,10 @@ define(
                 */
                getDialog: function(id) {
                        return _dialogs.get(id);
+               },
+               
+               _ajaxSetup: function() {
+                       return {};
                }
        };