From 366a134413586f3ddbf453ea1601eb1944d43d90 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Thu, 2 May 2013 16:02:16 +0200 Subject: Make it simple to create a new thread instead of replying --- hyperkitty/static/css/hyperkitty-common.css | 12 +++++++++++- hyperkitty/static/js/hyperkitty.js | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'hyperkitty/static') diff --git a/hyperkitty/static/css/hyperkitty-common.css b/hyperkitty/static/css/hyperkitty-common.css index b385f1d..26b1153 100644 --- a/hyperkitty/static/css/hyperkitty-common.css +++ b/hyperkitty/static/css/hyperkitty-common.css @@ -47,7 +47,7 @@ /* Forms (replies, registration, ...) */ form .buttons .submit { /* leave some space before the cancel button/link */ - margin-right: 2em; + margin-right: 1em; } @@ -210,11 +210,21 @@ a.reply.disabled { padding-top: 1em; } .reply-form p.reply-tools { + margin-bottom: 0.7em; +} +.reply-form p.reply-tools label { + display: inline; font-size: 90%; + margin-left: 1.5em; +} +.reply-form p.reply-tools input { + margin-top: 0; + margin-right: 0.1em; } .reply-form p { margin: 0; } +.reply-form #id_subject, .reply-form textarea { width: 95%; } 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() { $('
' + ' ' + jqXHR.responseText + '
') - .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(); } -- cgit