summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-08-03 16:04:35 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-08-03 16:04:35 +0200
commit3c1e355bdf068aaaaf7594897e1b78caf732d4d2 (patch)
tree3c7a306dc6fec5d058f33e60e0904e0c4bd17edc
parent5ea2dc6bb7da2b51077e5dabb03a8fcc6334cd5e (diff)
downloadhyperkitty-3c1e355bdf068aaaaf7594897e1b78caf732d4d2.tar.gz
hyperkitty-3c1e355bdf068aaaaf7594897e1b78caf732d4d2.tar.xz
hyperkitty-3c1e355bdf068aaaaf7594897e1b78caf732d4d2.zip
Fix attachments widget on replies
-rw-r--r--hyperkitty/static/hyperkitty/js/hyperkitty-common.js9
-rw-r--r--hyperkitty/static/hyperkitty/js/hyperkitty-thread.js6
-rw-r--r--hyperkitty/views/forms.py4
3 files changed, 14 insertions, 5 deletions
diff --git a/hyperkitty/static/hyperkitty/js/hyperkitty-common.js b/hyperkitty/static/hyperkitty/js/hyperkitty-common.js
index b9fc897..1fb1eb3 100644
--- a/hyperkitty/static/hyperkitty/js/hyperkitty-common.js
+++ b/hyperkitty/static/hyperkitty/js/hyperkitty-common.js
@@ -77,7 +77,10 @@ function setup_vote(baseElem) {
* New messages (or replies)
*/
-function setup_attachments() {
+function setup_attachments(baseElem) {
+ if (!baseElem) {
+ baseElem = document;
+ }
function add_attach_form (e) {
e.preventDefault();
var form = $(this).parents("form").first();
@@ -95,8 +98,8 @@ function setup_attachments() {
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);
+ $(baseElem).find(".attach-files-add").click(add_attach_form);
+ $(baseElem).find(".attach-files-first").click(add_attach_form);
}
diff --git a/hyperkitty/static/hyperkitty/js/hyperkitty-thread.js b/hyperkitty/static/hyperkitty/js/hyperkitty-thread.js
index e6c726f..c7b69a5 100644
--- a/hyperkitty/static/hyperkitty/js/hyperkitty-thread.js
+++ b/hyperkitty/static/hyperkitty/js/hyperkitty-thread.js
@@ -145,6 +145,7 @@ function setup_favorites() {
}
+
/*
* Replies
*/
@@ -297,9 +298,13 @@ function setup_unreadnavbar(element) {
}
+
/*
* Thread replies list
+ * Updates the list of replies in a thread chunk-by-chunk to avoid blocking the
+ * UI
*/
+
function update_thread_replies(url) {
function load_more(current_url) {
$.ajax({
@@ -315,6 +320,7 @@ function update_thread_replies(url) {
fold_quotes(newcontent);
setup_disabled_tooltips(newcontent);
setup_vote(newcontent);
+ setup_attachments(newcontent);
// load the rest if applicable
if (data.more_pending) {
load_more(url+"&offset="+data.next_offset);
diff --git a/hyperkitty/views/forms.py b/hyperkitty/views/forms.py
index 19bba26..648f43e 100644
--- a/hyperkitty/views/forms.py
+++ b/hyperkitty/views/forms.py
@@ -109,8 +109,8 @@ class AttachmentFileInput(forms.FileInput):
%(input)s <a href="#" title="%(rm_text)s">(-)</a>
</span>
<span class="attach-files"></span>
-<a class="attach-files-first">%(attach_first_text)s</a>
-<a class="attach-files-add">%(attach_another_text)s</a>
+<a href="#" class="attach-files-first">%(attach_first_text)s</a>
+<a href="#" class="attach-files-add">%(attach_another_text)s</a>
"""
def render(self, name, value, attrs=None):