]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix counters not being updated
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 7 May 2013 12:28:49 +0000 (16:28 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 7 May 2013 12:28:49 +0000 (16:28 +0400)
js/FeedTree.js
tt-rss.css

index a3761ad2e349e8125464f523749c929186523d0b..6c7e565ba5038fe09ee86848381d62645ab58c0f 100644 (file)
@@ -186,13 +186,38 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
 
                ctr = dojo.doc.createElement('span');
                ctr.className = 'counterNode';
-               ctr.innerHTML = '0';
+               ctr.innerHTML = args.item.unread;
+
+               args.item.unread > 0 ? ctr.addClassName("unread") : ctr.removeClassName("unread");
+
                dojo.place(ctr, tnode.labelNode, 'after');
                tnode.counterNode = ctr;
 
                //tnode.labelNode.innerHTML = args.label;
                return tnode;
        },
+       postCreate: function() {
+               this.connect(this.model, "onChange", "updateCounter");
+
+               this.inherited(arguments);
+       },
+       updateCounter: function (item) {
+               var tree = this;
+
+               //console.log("updateCounter: " + item.id[0] + " " + item.unread + " " + tree);
+
+               var node = tree._itemNodesMap[item.id];
+
+               if (node) {
+                       node = node[0];
+
+                       if (node.counterNode) {
+                               node.counterNode.innerHTML = item.unread;
+                               item.unread > 0 ? node.counterNode.addClassName("unread") : node.counterNode.removeClassName("unread");
+                       }
+               }
+
+       },
        getTooltip: function (item) {
                if (item.updated)
                        return item.updated;
index 09a3505afc3a21563fd760b60fe5d0d596cb0bb6..00db7d0e432d038940bcfd24afa35a7c417f7762 100644 (file)
@@ -1032,3 +1032,22 @@ div.hl.active a.title {
        height : 100%;
        overflow-x : hidden;
 }
+
+#feedTree span.counterNode {
+       display : none;
+}
+
+#feedTree span.counterNode.unread {
+       font-weight : bold;
+       display : inline-block;
+       font-size : 9px;
+       text-align : center;
+       border : 1px solid #88b0f0;
+       color : white;
+       background : #88b0f0;
+       border-radius : 4px;
+       padding : 0px 4px 0px 4px;
+       vertical-align : middle;
+}
+
+