diff options
author | Brion Vibber <brion@pobox.com> | 2010-12-01 14:23:56 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-12-01 14:23:56 -0800 |
commit | 5d9d0d7349ac757869a76ccd01dfde65d3f54273 (patch) | |
tree | 1608fe38cf15ec74c1ab190f3d709ab7b15ea55b /js | |
parent | 36d605a1e9b8ca05c5f9342602731e11346f3447 (diff) |
Ticket #2912 further cleanup: use JS on emailsettings form to help connect the 'I want to post by email' checkbox with the controls for adding or removing a post-by-email alias.
Now, when you first come up the checkbox will most likely be off and the button to create an address is grayed out.
Checking the box enables use of the 'new' button to generate an email address -- it's left disabled until you check the box, so you can't accidentally trip it.
Actually adding the address now enables the post-by-mail option, as well, thus ensuring that it's saved. WARNING: OTHER CHANGES ON THE FORM WILL STILL BE LOST.
Removing the address now disables the post-by-mail option, so it's not sitting around confusingly enabled but useless.
You can still disable the checkbox manually without removing the address, in case you want to keep it for later.
It's also still possible to actually save it in the state where the option is enabled, but there's no configured address, but that shouldn't happen too often. Possibly that should be prevented outright though.
Diffstat (limited to 'js')
-rw-r--r-- | js/emailsettings.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/emailsettings.js b/js/emailsettings.js new file mode 100644 index 000000000..c7f85fe9a --- /dev/null +++ b/js/emailsettings.js @@ -0,0 +1,23 @@ +$(function() { + +function toggleIncomingOptions() { + var enabled = $('#emailpost').attr('checked'); + if (enabled) { + // Note: button style currently does not respond to disabled in our main themes. + // Graying out the whole section with a 50% transparency will do for now. :) + // @todo: add a general 'disabled' class style to the base themes. + $('#emailincoming').removeAttr('style') + .find('input').removeAttr('disabled'); + } else { + $('#emailincoming').attr('style', 'opacity: 0.5') + .find('input').attr('disabled', 'disabled'); + } +} + +toggleIncomingOptions(); + +$('#emailpost').click(function() { + toggleIncomingOptions(); +}); + +}); |