summaryrefslogtreecommitdiffstats
path: root/hyperkitty/static/js
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-07-10 19:02:39 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-07-10 19:02:39 +0200
commit5b18d42d67afc08f469ec216b1d55adeb19feda8 (patch)
treef159cfb488b7f1c25c0a78cd882daaafb794f0a4 /hyperkitty/static/js
parentf2950f4b226b5a7d388c4eb2fb6c383e72ac6d54 (diff)
downloadhyperkitty-5b18d42d67afc08f469ec216b1d55adeb19feda8.tar.gz
hyperkitty-5b18d42d67afc08f469ec216b1d55adeb19feda8.tar.xz
hyperkitty-5b18d42d67afc08f469ec216b1d55adeb19feda8.zip
Add categories to threads
Diffstat (limited to 'hyperkitty/static/js')
-rw-r--r--hyperkitty/static/js/hyperkitty-thread.js34
1 files changed, 33 insertions, 1 deletions
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
@@ -21,6 +21,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) {