reply to comment now nests to max. level of 1, part of #79

pull/80/merge
Martin Zimmermann 10 years ago
parent 5d2daa1244
commit 9ee0a1a2eb

@ -75,7 +75,6 @@ define(["app/text/html", "app/dom", "app/utils", "app/config", "app/api", "app/m
if (parent !== null) {
el.onsuccess();
el.remove();
}
});
});
@ -85,16 +84,8 @@ define(["app/text/html", "app/dom", "app/utils", "app/config", "app/api", "app/m
return el;
};
// lookup table for responses (to link to the parent)
var map = {id: {}, name: {}};
var insert = function(comment, scrollIntoView) {
map.name[comment.id] = comment.author;
if (comment.parent) {
comment["replyto"] = map.name[comment.parent];
}
var el = $.htmlify(Mark.up(templates["comment"], comment));
// update datetime every 60 seconds
@ -113,12 +104,7 @@ define(["app/text/html", "app/dom", "app/utils", "app/config", "app/api", "app/m
if (comment.parent === null) {
entrypoint = $("#isso-root");
} else {
var key = comment.parent;
while (key in map.id) {
key = map.id[key];
}
map.id[comment.id] = comment.parent;
entrypoint = $("#isso-" + key + " > .text-wrapper > .isso-follow-up");
entrypoint = $("#isso-" + comment.parent + " > .text-wrapper > .isso-follow-up");
}
entrypoint.append(el);
@ -134,26 +120,17 @@ define(["app/text/html", "app/dom", "app/utils", "app/config", "app/api", "app/m
var form = null; // XXX: probably a good place for a closure
$("a.reply", footer).toggle("click",
function(toggler) {
form = footer.insertAfter(new Postbox(comment.id));
form = footer.insertAfter(new Postbox(comment.parent === null ? comment.id : comment.parent));
form.onsuccess = function() { toggler.next(); };
$(".textarea", form).focus();
$("a.reply", footer).textContent = msgs["comment-close"];
},
function() {
form.remove();
form.remove()
$("a.reply", footer).textContent = msgs["comment-reply"];
}
);
if (comment.parent !== null) {
$("a.parent", header).on("mouseover", function() {
$("#isso-" + comment.parent).classList.add("parent-highlight");
});
$("a.parent", header).on("mouseout", function() {
$("#isso-" + comment.parent).classList.remove("parent-highlight");
});
}
// update vote counter, but hide if votes sum to 0
var votes = function(value) {
var span = $("span.votes", footer);

@ -14,13 +14,6 @@
</span>
{{ /if }}
{{ if parent }}
<span class="spacer"></span>
<a class="parent" href="#isso-{{ parent }}">
<i>{{ svg-forward }}</i>{{ replyto | blank: `i18n-comment-anonymous` }}
</a>
{{ /if }}
<span class="spacer"></span>
<a class="permalink" href="#isso-{{ id }}">

@ -9,7 +9,6 @@ import sqlite3
import tempfile
from isso.db import SQLite3
from isso.db.comments import Comments
from isso.core import Config
from isso.compat import iteritems

Loading…
Cancel
Save