]> git.wh0rd.org - tt-rss.git/blobdiff - js/PrefFeedTree.js
properly show cached images in syndicated feeds
[tt-rss.git] / js / PrefFeedTree.js
index 9e2ee0662498abecc70b4bf3a66b42cdda5736e8..bf21baa9045754a52706bc3681eb36b935c3684e 100644 (file)
@@ -5,7 +5,7 @@ dojo.require("lib.CheckBoxTree");
 dojo.require("dojo.data.ItemFileWriteStore");
 
 dojo.declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, {
-       
+
        _saveEverything: function(saveCompleteCallback, saveFailedCallback,
                                                                newFileContentString) {
 
@@ -17,7 +17,7 @@ dojo.declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, {
                        load: saveCompleteCallback});
        },
 
-});            
+});
 
 dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
        _createTreeNode: function(args) {
@@ -32,7 +32,53 @@ dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
                        param = dojo.doc.createElement('span');
                        param.className = 'feedParam';
                        param.innerHTML = args.item.param[0];
-                       dojo.place(param, tnode.labelNode, 'after');
+                       //dojo.place(param, tnode.labelNode, 'after');
+                       dojo.place(param, tnode.rowNode, 'first');
+               }
+
+               var id = args.item.id[0];
+               var bare_id = parseInt(id.substr(id.indexOf(':')+1));
+
+               if (id.match("CAT:") && bare_id > 0) {
+                       var menu = new dijit.Menu();
+                       menu.row_id = bare_id;
+                       menu.item = args.item;
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Edit category"),
+                               onClick: function() {
+                                       editCat(this.getParent().row_id, this.getParent().item, null);
+                               }}));
+
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Remove category"),
+                               onClick: function() {
+                                       removeCategory(this.getParent().row_id, this.getParent().item);
+                               }}));
+
+                       menu.bindDomNode(tnode.domNode);
+                       tnode._menu = menu;
+               } else if (id.match("FEED:")) {
+                       var menu = new dijit.Menu();
+                       menu.row_id = bare_id;
+                       menu.item = args.item;
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Edit feed"),
+                               onClick: function() {
+                                       editFeed(this.getParent().row_id);
+                               }}));
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Unsubscribe"),
+                               onClick: function() {
+                                       unsubscribeFeed(this.getParent().row_id, this.getParent().item.name);
+                               }}));
+
+                       menu.bindDomNode(tnode.domNode);
+                       tnode._menu = menu;
+
                }
 
                return tnode;
@@ -42,7 +88,7 @@ dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
                this.tree.model.store.save();
        },
        getRowClass: function (item, opened) {
-               return (!item.error || item.error == '') ? "dijitTreeRow" : 
+               return (!item.error || item.error == '') ? "dijitTreeRow" :
                        "dijitTreeRow Error";
        },
        getIconClass: function (item, opened) {
@@ -71,7 +117,7 @@ dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
                        return ((id.match("CAT:") && position == "over") ||
                                (id.match("FEED:") && position != "over"));
                } else if (source_id.match("CAT:")) {
-                       return ((id.match("CAT:") && position != "over") ||
+                       return ((id.match("CAT:") && !id.match("CAT:0")) ||
                                (id.match("root") && position == "over"));
                }
        },