From f96cdb7d5d79f60885cdebc94497c0618f5fe4a5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 10 Dec 2018 16:10:19 +0300 Subject: [PATCH] renderAgain flag fixes --- js/Headlines.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/js/Headlines.js b/js/Headlines.js index 7564d48dd..bb2eb398b 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -238,12 +238,15 @@ define(["dojo/_base/declare"], function (declare) { return this.headlines[id]; }, renderAgain: function() { + // TODO: wrap headline elements into a knockoutjs model to prevent all this stuff + $$("#headlines-frame > div[id*=RROW]").each((row) => { const id = row.getAttribute("data-article-id"); const selected = row.hasClassName("Selected"); const active = row.hasClassName("active"); const marked = row.hasClassName("marked"); const published = row.hasClassName("published"); + const unread = row.hasClassName("Unread"); if (this.headlines[id]) { const new_row = this.render({}, this.headlines[id]); @@ -261,8 +264,20 @@ define(["dojo/_base/declare"], function (declare) { if (selected) this.select("all", id); - if (marked) new_row.addClassName("marked"); - if (published) new_row.addClassName("published"); + if (marked) + new_row.addClassName("marked"); + else + new_row.removeClassName("marked"); + + if (published) + new_row.addClassName("published"); + else + new_row.removeClassName("published"); + + if (unread) + new_row.addClassName("Unread"); + else + new_row.removeClassName("Unread"); Article.unpack(new_row);