]> git.wh0rd.org - tt-rss.git/commitdiff
be more smart with label assignments to selection in headline context menu
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 23 Aug 2012 19:59:46 +0000 (23:59 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 23 Aug 2012 19:59:46 +0000 (23:59 +0400)
js/viewfeed.js

index 4bb56ddfa503e0fa3cb517f10ffb261d17e3078f..05b36f2bc8896c5227cd6bf80d495795852bebc5 100644 (file)
@@ -1930,16 +1930,26 @@ function initHeadlinesMenu() {
                                        label: name,
                                        labelId: bare_id,
                                        onClick: function(event) {
-                                               selectionAssignLabel(this.labelId,
-                                                       [this.getParent().ownerMenu.callerRowId]);
+                                               var ids = getSelectedArticleIds2();
+                                               // cast to string
+                                               var id = this.getParent().ownerMenu.callerRowId + "";
+
+                                               ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+
+                                               selectionAssignLabel(this.labelId, ids);
                                }}));
 
                                labelDelMenu.addChild(new dijit.MenuItem({
                                        label: name,
                                        labelId: bare_id,
                                        onClick: function(event) {
-                                               selectionRemoveLabel(this.labelId,
-                                                       [this.getParent().ownerMenu.callerRowId]);
+                                               var ids = getSelectedArticleIds2();
+                                               // cast to string
+                                               var id = this.getParent().ownerMenu.callerRowId + "";
+
+                                               ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+
+                                               selectionRemoveLabel(this.labelId, ids);
                                }}));
 
                        });