summaryrefslogtreecommitdiffstats
path: root/hyperkitty/static/js
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-07-08 12:49:49 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-07-08 12:49:49 +0200
commitf2950f4b226b5a7d388c4eb2fb6c383e72ac6d54 (patch)
tree7380a1fc573bf77bdbc915a1d45ae291fabc605e /hyperkitty/static/js
parent8301b45160da213d1f52fddc3527b81959dd3a08 (diff)
downloadhyperkitty-f2950f4b226b5a7d388c4eb2fb6c383e72ac6d54.tar.gz
hyperkitty-f2950f4b226b5a7d388c4eb2fb6c383e72ac6d54.tar.xz
hyperkitty-f2950f4b226b5a7d388c4eb2fb6c383e72ac6d54.zip
Make a widget to add multiple attachments
Diffstat (limited to 'hyperkitty/static/js')
-rw-r--r--hyperkitty/static/js/hyperkitty-common.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/hyperkitty/static/js/hyperkitty-common.js b/hyperkitty/static/js/hyperkitty-common.js
index 2d2ff16..b9fc897 100644
--- a/hyperkitty/static/js/hyperkitty-common.js
+++ b/hyperkitty/static/js/hyperkitty-common.js
@@ -74,6 +74,33 @@ function setup_vote(baseElem) {
/*
+ * New messages (or replies)
+ */
+
+function setup_attachments() {
+ function add_attach_form (e) {
+ e.preventDefault();
+ var form = $(this).parents("form").first();
+ form.find(".attach-files-template")
+ .clone().removeClass("attach-files-template")
+ .appendTo(form.find(".attach-files"));
+ form.find(".attach-files span a").click(function (e) {
+ e.preventDefault();
+ $(this).parent().remove();
+ if (form.find(".attach-files input").length === 0) {
+ form.find(".attach-files-add").hide();
+ form.find(".attach-files-first").show();
+ };
+ });
+ form.find(".attach-files-first").hide();
+ form.find(".attach-files-add").show();
+ }
+ $(".attach-files-add").click(add_attach_form);
+ $(".attach-files-first").click(add_attach_form);
+}
+
+
+/*
* Misc.
*/
@@ -110,4 +137,5 @@ $(document).ready(function() {
setup_months_list();
setup_disabled_tooltips();
setup_flash_messages();
+ setup_attachments();
});