]> git.wh0rd.org Git - tt-rss.git/commitdiff
enable server-side storage of collapsed status of categories
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 20 Nov 2010 08:52:11 +0000 (11:52 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 20 Nov 2010 08:54:57 +0000 (11:54 +0300)
FeedTree.js
tt-rss.js

index 76b46601be5a410f11064f3f8f02716540755758..18112f6b7d48b4fc267c798b3ac840d0c5393e7d 100644 (file)
@@ -237,4 +237,22 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
        
                return cat_unread;
        },
+       collapseHiddenCats: function() {
+               if (!this.model.hasCats()) return;
+
+               var cats = this.model.store._arrayOfTopLevelItems;
+               var tree = this;
+
+               dojo.forEach(cats, function(cat) {
+                       var hidden = tree.model.store.getValue(cat, 'hidden');
+                       var id = tree.model.store.getValue(cat, 'id');
+                       var node = tree._itemNodesMap[id][0];
+
+                       if (hidden) 
+                               tree._collapseNode(node);
+                       else
+                               tree._expandNode(node);
+
+               });
+       },
 });
index a4082bd8b8203a96c77854fdb2b9ca7d0a68b100..aa23ea075be67f7e24146b85c61d619e9525b1eb 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -92,7 +92,7 @@ function updateFeedList() {
 
                        new Ajax.Request("backend.php", 
                                { parameters: "backend.php?op=feeds&subop=collapse&cid=" + 
-                                       param_escape(cat_id) + "&mode=1" } );
+                                       param_escape(cat_id) + "&mode=0" } );
           },
                onClose: function (item, node) {
                        var id = String(item.id);
@@ -100,7 +100,7 @@ function updateFeedList() {
 
                        new Ajax.Request("backend.php", 
                                { parameters: "backend.php?op=feeds&subop=collapse&cid=" + 
-                                       param_escape(cat_id) + "&mode=0" } );
+                                       param_escape(cat_id) + "&mode=1" } );
 
           },
                onClick: function (item, node) {
@@ -133,6 +133,9 @@ function updateFeedList() {
                var tmph = dojo.connect(tree, 'onLoad', function() {
                dojo.disconnect(tmph);
                        Element.hide("feedlistLoading");
+
+                       tree.collapseHiddenCats();
+
                        feedlist_init();
 
 //                     var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode