From 5b18d42d67afc08f469ec216b1d55adeb19feda8 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Wed, 10 Jul 2013 19:02:39 +0200 Subject: Add categories to threads --- hyperkitty/static/js/hyperkitty-thread.js | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'hyperkitty/static/js/hyperkitty-thread.js') diff --git a/hyperkitty/static/js/hyperkitty-thread.js b/hyperkitty/static/js/hyperkitty-thread.js index 5b7765d..f2c3cd0 100644 --- a/hyperkitty/static/js/hyperkitty-thread.js +++ b/hyperkitty/static/js/hyperkitty-thread.js @@ -20,6 +20,39 @@ */ +/* + * Categories + */ + +function setup_category() { + $("#thread-category form").submit(function (e) { + e.preventDefault(); + $.ajax({ + type: "POST", + //dataType: "json", + data : $(this).serialize(), + url: $(this).attr("action"), + success: function(data) { + $("#thread-category").html(data); + setup_category(); + }, + error: function(jqXHR, textStatus, errorThrown) { + // authentication and invalid data + alert(jqXHR.responseText); + } + }); + }); + $("#thread-category a.label").click(function(e) { + e.preventDefault(); + $(this).hide(); + $("#thread-category form").show(); + }); + $("#thread-category form select").change(function() { + $(this).parents("form").first().submit(); + }); +} + + /* * Tagging */ @@ -39,7 +72,6 @@ function setup_tags() { e.preventDefault(); $(this).parents("form").first().submit(); }); - console.log($(this)); $(this).find("#id_tag").value(""); }, error: function(jqXHR, textStatus, errorThrown) { -- cgit