X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=ang%2FcrmMailing%2FBlockPreview.js;h=5e582dc0566a0d5cb06576db3bf397c66cbf1a4f;hb=179cb5e37a971a2666d80918c072852ee00babd5;hp=36b72ea981dfe91cde338439a877c741385386d0;hpb=8c00bf7a03f3dbe78d2d43d1fecde6a76ffe9ad9;p=civicrm-core.git diff --git a/ang/crmMailing/BlockPreview.js b/ang/crmMailing/BlockPreview.js index 36b72ea981..5e582dc056 100644 --- a/ang/crmMailing/BlockPreview.js +++ b/ang/crmMailing/BlockPreview.js @@ -21,6 +21,7 @@ }); }; scope.doSend = function doSend(recipient) { + recipient = JSON.parse(JSON.stringify(recipient).replace(/\,\s/g, ',')); scope.$eval(attr.onSend, { preview: {recipient: recipient} }); @@ -29,16 +30,15 @@ scope.previewTestGroup = function(e) { var $dialog = $(this); $dialog.html('
').parent().find('button[data-op=yes]').prop('disabled', true); - $dialog.dialog('option', 'title', ts('Send to %1', {1: _.pluck(_.where(scope.crmMailingConst.testGroupNames, {id: scope.testGroup.gid}), 'title')[0]})); - CRM.api3('contact', 'get', { - group: scope.testGroup.gid, - options: {limit: 0}, - return: 'display_name,email' + CRM.api3({ + contact: ['contact', 'get', {group: scope.testGroup.gid, options: {limit: 0}, return: 'display_name,email'}], + group: ['group', 'getsingle', {id: scope.testGroup.gid, return: 'title'}] }).done(function(data) { + $dialog.dialog('option', 'title', ts('Send to %1', {1: data.group.title})); var count = 0, // Fixme: should this be in a template? - markup = '
    '; - _.each(data.values, function(row) { + markup = '
      '; + _.each(data.contact.values, function(row) { // Fixme: contact api doesn't seem capable of filtering out contacts with no email, so we're doing it client-side if (row.email) { count++; @@ -49,7 +49,7 @@ markup = '

      ' + ts('A test message will be sent to %1 people:', {1: count}) + '

      ' + markup; if (!count) { markup = '
      ' + - (data.count ? ts('None of the contacts in this group have an email address.') : ts('Group is empty.')) + + (data.contact.count ? ts('None of the contacts in this group have an email address.') : ts('Group is empty.')) + '
      '; } $dialog