Merge pull request #615 from creative-commoners/pulls/4.2/fix-plain-or-html-toggle

FIX Selector for HTML/plain email content toggle. Show preview button for both.
This commit is contained in:
Franco Springveldt 2017-06-27 09:33:53 +12:00 committed by GitHub
commit 9edc5c3230
2 changed files with 4 additions and 8 deletions

View File

@ -261,10 +261,7 @@ class UserDefinedForm_EmailRecipient extends DataObject
->addExtraClass('toggle-html-only'),
TextareaField::create('EmailBody', _t('UserDefinedForm.EMAILBODY', 'Body'))
->addExtraClass('toggle-plain-only'),
LiteralField::create(
'EmailPreview',
'<div id="EmailPreview" class="field toggle-html-only">' . $preview . '</div>'
)
LiteralField::create('EmailPreview', $preview)
));
$fields->fieldByName('Root.EmailContent')->setTitle(_t('UserDefinedForm_EmailRecipient.EMAILCONTENTTAB', 'Email Content'));

View File

@ -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();
}