From 01b27e25986421198f4b811cb9c73aff3366f073 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Tue, 7 Jan 2014 11:06:41 +0000 Subject: [PATCH] Issue #2158979 by nod_: Drupal.dialog expects a DOM element, not a string or jQuery object. --- core/misc/dialog.ajax.js | 4 ++-- core/modules/ckeditor/js/ckeditor.admin.js | 3 ++- core/modules/edit/js/util.js | 3 ++- core/modules/edit/js/views/AppView.js | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/misc/dialog.ajax.js b/core/misc/dialog.ajax.js index c33a5e69971..d2d8d3a88ce 100644 --- a/core/misc/dialog.ajax.js +++ b/core/misc/dialog.ajax.js @@ -105,7 +105,7 @@ // Open the dialog itself. response.dialogOptions = response.dialogOptions || {}; - var dialog = Drupal.dialog($dialog, response.dialogOptions); + var dialog = Drupal.dialog($dialog.get(0), response.dialogOptions); if (response.dialogOptions.modal) { dialog.showModal(); } @@ -125,7 +125,7 @@ Drupal.AjaxCommands.prototype.closeDialog = function (ajax, response, status) { var $dialog = $(response.selector); if ($dialog.length) { - Drupal.dialog($dialog).close(); + Drupal.dialog($dialog.get(0)).close(); if (!response.persist) { $dialog.remove(); } diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js index d519d66f7c4..0e8f5b10514 100644 --- a/core/modules/ckeditor/js/ckeditor.admin.js +++ b/core/modules/ckeditor/js/ckeditor.admin.js @@ -1345,7 +1345,8 @@ function openGroupNameDialog (view, $group, callback) { } // Create a Drupal dialog that will get a button group name from the user. - var dialog = Drupal.dialog(Drupal.theme('ckeditorButtonGroupNameForm'), { + var $ckeditorButtonGroupNameForm = $(Drupal.theme('ckeditorButtonGroupNameForm')); + var dialog = Drupal.dialog($ckeditorButtonGroupNameForm.get(0), { title: Drupal.t('Button group name'), dialogClass: 'ckeditor-name-toolbar-group', resizable: false, diff --git a/core/modules/edit/js/util.js b/core/modules/edit/js/util.js index 6e1aaab6ad1..da7656e37df 100644 --- a/core/modules/edit/js/util.js +++ b/core/modules/edit/js/util.js @@ -41,7 +41,8 @@ Drupal.edit.util.buildUrl = function (id, urlFormat) { * The message to use in the modal dialog. */ Drupal.edit.util.networkErrorModal = function (title, message) { - var networkErrorModal = Drupal.dialog('
' + message + '
', { + var $message = $('
' + message + '
'); + var networkErrorModal = Drupal.dialog($message.get(0), { title: title, dialogClass: 'edit-network-error', buttons: [ diff --git a/core/modules/edit/js/views/AppView.js b/core/modules/edit/js/views/AppView.js index 93caf5c0c94..ba65c3ee65b 100644 --- a/core/modules/edit/js/views/AppView.js +++ b/core/modules/edit/js/views/AppView.js @@ -350,7 +350,8 @@ Drupal.edit.AppView = Backbone.View.extend({ // Only instantiate if there isn't a modal instance visible yet. if (!this.model.get('activeModal')) { - discardDialog = Drupal.dialog('
' + Drupal.t('You have unsaved changes') + '
', { + var $unsavedChanges = $('
' + Drupal.t('You have unsaved changes') + '
'); + discardDialog = Drupal.dialog($unsavedChanges.get(0), { title: Drupal.t('Discard changes?'), dialogClass: 'edit-discard-modal', resizable: false,