From e96594247b9b86fd13ae661285312089a034997a Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 9 Jun 2017 11:04:52 +1200 Subject: [PATCH] FIX Selector for HTML/plain email content toggle. Show preview button for both. --- code/model/recipients/UserDefinedForm_EmailRecipient.php | 7 ++----- javascript/Recipient.js | 7 +++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/code/model/recipients/UserDefinedForm_EmailRecipient.php b/code/model/recipients/UserDefinedForm_EmailRecipient.php index 79110f3..fb36634 100644 --- a/code/model/recipients/UserDefinedForm_EmailRecipient.php +++ b/code/model/recipients/UserDefinedForm_EmailRecipient.php @@ -258,12 +258,9 @@ class UserDefinedForm_EmailRecipient extends DataObject ->addExtraClass('toggle-html-only'), TextareaField::create('EmailBody', _t('UserDefinedForm.EMAILBODY', 'Body')) ->addExtraClass('toggle-plain-only'), - LiteralField::create( - 'EmailPreview', - '
' . $preview . '
' - ) + LiteralField::create('EmailPreview', $preview) )); - + $fields->fieldByName('Root.EmailContent')->setTitle(_t('UserDefinedForm_EmailRecipient.EMAILCONTENTTAB', 'Email Content')); // Custom rules for sending this field diff --git a/javascript/Recipient.js b/javascript/Recipient.js index 0bae6bf..0e97c57 100644 --- a/javascript/Recipient.js +++ b/javascript/Recipient.js @@ -5,12 +5,11 @@ (function ($) { $(document).ready(function () { + var sendPlain = $('input[name="SendPlain"]'); var recipient = { // Some fields are only visible when HTML email are being sent. updateFormatSpecificFields: function () { - var sendPlainChecked = $('#SendPlain') - .find('input[type="checkbox"]') - .is(':checked'); + var sendPlainChecked = sendPlain.is(':checked'); $(".field.toggle-html-only")[sendPlainChecked ? 'hide' : 'show'](); $(".field.toggle-plain-only")[sendPlainChecked ? 'show' : 'hide'](); @@ -27,7 +26,7 @@ } }); - $('#SendPlain').entwine({ + sendPlain.entwine({ onchange: function () { recipient.updateFormatSpecificFields(); }