mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
38 lines
841 B
JavaScript
38 lines
841 B
JavaScript
/**
|
|
* Email recipient behaviour.
|
|
*/
|
|
|
|
(function ($) {
|
|
$(document).ready(function () {
|
|
|
|
var recipient = {
|
|
// Some fields are only visible when HTML email are being sent.
|
|
updateFormatSpecificFields: function () {
|
|
var sendPlainChecked = $('#SendPlain')
|
|
.find('input[type="checkbox"]')
|
|
.is(':checked');
|
|
|
|
$(".field.toggle-html-only")[sendPlainChecked ? 'hide' : 'show']();
|
|
$(".field.toggle-plain-only")[sendPlainChecked ? 'show' : 'hide']();
|
|
}
|
|
};
|
|
|
|
$.entwine('udf.recipient', function ($) {
|
|
$('#Form_ItemEditForm').entwine({
|
|
onmatch: function () {
|
|
recipient.updateFormatSpecificFields();
|
|
},
|
|
onunmatch: function () {
|
|
this._super();
|
|
}
|
|
});
|
|
|
|
$('#SendPlain').entwine({
|
|
onchange: function () {
|
|
recipient.updateFormatSpecificFields();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}(jQuery));
|