summaryrefslogtreecommitdiff
path: root/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-11-19 22:18:26 +0300
committerAndrew Dolgov <[email protected]>2010-11-19 22:18:26 +0300
commit1beea8001786b6cbc8a9fc42574970aede1b56dd (patch)
tree82e32d19d9aa34dd4a32f3a4a296ad9de4fa2656 /viewfeed.js
parentbc372fe30fecfbf4a6d831b23480c057a989c79a (diff)
implement labels submenu; rework init process so that feedlist_init depends on feedTree being loaded
Diffstat (limited to 'viewfeed.js')
-rw-r--r--viewfeed.js44
1 files changed, 39 insertions, 5 deletions
diff --git a/viewfeed.js b/viewfeed.js
index dadbe9485..b7ef31a7c 100644
--- a/viewfeed.js
+++ b/viewfeed.js
@@ -669,10 +669,10 @@ function toggleUnread(id, cmode, effect) {
}
}
-function selectionRemoveLabel(id) {
+function selectionRemoveLabel(id, ids) {
try {
- var ids = getSelectedArticleIds2();
+ if (!ids) var ids = getSelectedArticleIds2();
if (ids.length == 0) {
alert(__("No articles are selected."));
@@ -707,10 +707,10 @@ function selectionRemoveLabel(id) {
}
}
-function selectionAssignLabel(id) {
+function selectionAssignLabel(id, ids) {
try {
- var ids = getSelectedArticleIds2();
+ if (!ids) ids = getSelectedArticleIds2();
if (ids.length == 0) {
alert(__("No articles are selected."));
@@ -2265,7 +2265,9 @@ function initHeadlinesMenu() {
label: __("View in a new tab"),
onClick: function(event) {
hlOpenInNewTab(event, this.getParent().callerRowId);
- }}));
+ }}));
+
+ menu.addChild(new dijit.MenuSeparator());
menu.addChild(new dijit.MenuItem({
label: __("Open original article"),
@@ -2273,6 +2275,38 @@ function initHeadlinesMenu() {
openArticleInNewWindow(this.getParent().callerRowId);
}}));
+ var labels = dijit.byId("feedTree").model.getItemsInCategory(-2);
+
+ if (labels) {
+
+ menu.addChild(new dijit.MenuSeparator());
+
+ var labelsMenu = new dijit.Menu({ownerMenu: menu});
+
+ labels.each(function(label) {
+ var id = label.id[0];
+ var bare_id = id.substr(id.indexOf(":")+1);
+ var name = label.name[0];
+
+ bare_id = -11-bare_id;
+
+ labelsMenu.addChild(new dijit.MenuItem({
+ label: name,
+ labelId: bare_id,
+ onClick: function(event) {
+ //console.log(this.labelId);
+ //console.log(this.getParent().ownerMenu.callerRowId);
+ selectionAssignLabel(this.labelId,
+ [this.getParent().ownerMenu.callerRowId]);
+ }}));
+ });
+
+ menu.addChild(new dijit.PopupMenuItem({
+ label: __("Labels"),
+ popup: labelsMenu,
+ }));
+ }
+
menu.startup();
} catch (e) {