diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-05-02 16:02:16 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-05-02 16:02:16 +0200 |
commit | 366a134413586f3ddbf453ea1601eb1944d43d90 (patch) | |
tree | 813e5cbfab4d9923511c1a6bf5d40bdba1daefc8 /hyperkitty/static/js/hyperkitty.js | |
parent | 89c624457ce8cb688b899995740d824a0bb3df74 (diff) | |
download | hyperkitty-366a134413586f3ddbf453ea1601eb1944d43d90.tar.gz hyperkitty-366a134413586f3ddbf453ea1601eb1944d43d90.tar.xz hyperkitty-366a134413586f3ddbf453ea1601eb1944d43d90.zip |
Make it simple to create a new thread instead of replying
Diffstat (limited to 'hyperkitty/static/js/hyperkitty.js')
-rw-r--r-- | hyperkitty/static/js/hyperkitty.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/hyperkitty/static/js/hyperkitty.js b/hyperkitty/static/js/hyperkitty.js index 6aa318d..05be5bc 100644 --- a/hyperkitty/static/js/hyperkitty.js +++ b/hyperkitty/static/js/hyperkitty.js @@ -161,6 +161,8 @@ function setup_replies() { $(".reply-form button[type='submit']").click(function(e) { e.preventDefault(); var form = $(this).parents("form").first(); + // remove previous error messages + form.find("div.reply-result").remove(); var data = form_to_json(form); $.ajax({ type: "POST", @@ -180,7 +182,7 @@ function setup_replies() { $('<div class="reply-result"><div class="alert alert-error">' + '<button type="button" class="close" data-dismiss="alert">×</button> ' + jqXHR.responseText + '</div></div>') - .css("display", "none").insertBefore(form).slideDown(); + .css("display", "none").prependTo(form).slideDown(); } }); }); @@ -207,6 +209,20 @@ function setup_replies() { textarea.val(quoted + "\n" + textarea.val()); textarea.focus(); }); + function set_new_thread(checkbox) { + var this_form = checkbox.parents("form").first(); + var subj = this_form.find("input[name='subject']").parents("p").first(); + if (checkbox.is(":checked")) { + subj.slideDown("fast"); + subj.find("input").focus(); + } else { + subj.slideUp("fast"); + this_form.find("textarea").focus(); + } + } + $(".reply-form input[name='newthread']").change(function() { + set_new_thread($(this)); + }).change(); } |