CRM-15412 - Fix CRM.confirm to add content before opening dialog
authorColeman Watts <coleman@civicrm.org>
Thu, 2 Oct 2014 18:34:20 +0000 (14:34 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 2 Oct 2014 18:34:20 +0000 (14:34 -0400)
js/Common.js

index 516acdc9bb88f0f3f7134519f9b92e0052cb83a5..4480978a87eec5eea8d4e6857f0e0884a7816278 100644 (file)
@@ -808,19 +808,19 @@ CRM.strings = CRM.strings || {};
       settings.buttons = _.sortBy(buttons, 'data-op').reverse();
     }
     url = settings.url;
-    msg = settings.message;
+    msg = url ? '' : settings.message;
     delete settings.options;
     delete settings.message;
     delete settings.url;
-    dialog = $('<div class="crm-confirm-dialog"></div>').dialog(settings);
+    dialog = $('<div class="crm-confirm-dialog"></div>').html(msg || '').dialog(settings);
     if ($.isFunction(options)) {
       dialog.on('crmConfirm:yes', options);
     }
     if (url) {
       CRM.loadPage(url, {target: dialog});
     }
-    else if (msg && msg.length) {
-      dialog.html(msg).trigger('crmLoad');
+    else {
+      dialog.trigger('crmLoad');
     }
     return dialog;
   };