From 9ee0a1a2ebec3c25a0b5c8ae9c57fc13611ba091 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Sun, 20 Apr 2014 16:30:18 +0200 Subject: [PATCH] reply to comment now nests to max. level of 1, part of #79 --- isso/js/app/isso.js | 29 +++-------------------------- isso/js/app/text/comment.html | 7 ------- isso/tests/test_db.py | 1 - 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/isso/js/app/isso.js b/isso/js/app/isso.js index 0bec02e..e903b6a 100644 --- a/isso/js/app/isso.js +++ b/isso/js/app/isso.js @@ -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); diff --git a/isso/js/app/text/comment.html b/isso/js/app/text/comment.html index e2431f2..e9cc1e1 100644 --- a/isso/js/app/text/comment.html +++ b/isso/js/app/text/comment.html @@ -14,13 +14,6 @@ {{ /if }} - {{ if parent }} - - - {{ svg-forward }}{{ replyto | blank: `i18n-comment-anonymous` }} - - {{ /if }} -