summaryrefslogtreecommitdiffstats
path: root/hyperkitty/static
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
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')
-rw-r--r--hyperkitty/static/css/hyperkitty-common.css21
-rw-r--r--hyperkitty/static/js/hyperkitty-common.js28
2 files changed, 49 insertions, 0 deletions
diff --git a/hyperkitty/static/css/hyperkitty-common.css b/hyperkitty/static/css/hyperkitty-common.css
index 1ff6e91..7b3190b 100644
--- a/hyperkitty/static/css/hyperkitty-common.css
+++ b/hyperkitty/static/css/hyperkitty-common.css
@@ -231,6 +231,9 @@ a.reply.disabled {
.reply-form textarea {
width: 95%;
}
+.reply-form p.buttons {
+ margin-top: 1em;
+}
.reply-result {
text-align: center;
}
@@ -264,6 +267,24 @@ a.thread-new strong {
.new-thread-form textarea {
width: 90%;
}
+.new-thread-form p.buttons {
+ margin-top: 2em;
+}
+
+
+/*
+ * Attachments in replies or new threads
+ */
+
+.attach-files-template {
+ display: none;
+}
+.attach-files-add {
+ display: none;
+}
+.attach-files span {
+ display: block;
+}
/* AJAX */
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();
});