From: Coleman Watts Date: Sun, 7 Sep 2014 23:47:44 +0000 (-0400) Subject: CRM.confirm - support loading remote content X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3f4328da58b2e7396ae751b7960881ef4b5feb72;p=civicrm-core.git CRM.confirm - support loading remote content --- diff --git a/js/Common.js b/js/Common.js index 9c0e21ed3a..abd4bf0994 100644 --- a/js/Common.js +++ b/js/Common.js @@ -775,9 +775,10 @@ CRM.strings = CRM.strings || {}; * @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference */ CRM.confirm = function (options) { - var dialog, settings = { + var dialog, url, msg, settings = { title: ts('Confirm'), message: ts('Are you sure you want to continue?'), + url: null, width: 'auto', modal: true, resizable: false, @@ -807,13 +808,22 @@ CRM.strings = CRM.strings || {}; }); }); } - dialog = $('
').html(settings.message); + url = settings.url; + msg = settings.message; delete settings.options; delete settings.message; + delete settings.url; + dialog = $('
').dialog(settings); if ($.isFunction(options)) { dialog.on('crmConfirm:yes', options); } - return dialog.dialog(settings).trigger('crmLoad'); + if (url) { + CRM.loadPage(url, {target: dialog}); + } + else if (msg && msg.length) { + dialog.html(msg).trigger('crmLoad'); + } + return dialog; }; /** provides a local copy of ts for a domain */ diff --git a/templates/CRM/Case/Form/ActivityToCase.tpl b/templates/CRM/Case/Form/ActivityToCase.tpl index afa678a178..72518648ca 100644 --- a/templates/CRM/Case/Form/ActivityToCase.tpl +++ b/templates/CRM/Case/Form/ActivityToCase.tpl @@ -128,9 +128,7 @@ width: '600', resizable: true, options: {yes: "{/literal}{ts escape='js'}Save{/ts}{literal}", no: "{/literal}{ts escape='js'}Cancel{/ts}{literal}"}, - open: function() { - CRM.loadPage(dataUrl, {target: this}); - } + url: dataUrl }).on('crmConfirm:yes', save); }