fix label issues

This commit is contained in:
Athou
2013-03-22 07:31:15 +01:00
parent 42f9b38f68
commit 905bea4a1a
4 changed files with 27 additions and 9 deletions

View File

@@ -37,12 +37,14 @@ module.controller('CategoryTreeCtrl',
var unreadCount = function(category) {
var count = 0;
console.log(category)
for ( var child in category.children) {
count = count + unreadCount(child);
if (category.children) {
for ( var i = 0; i < category.children.length; i++) {
count = count + unreadCount(category.children[i]);
}
}
for ( var feed in category.feeds) {
if (feed.unread) {
if (category.feeds) {
for ( var i = 0; i < category.feeds.length; i++) {
var feed = category.feeds[i];
count = count + feed.unread;
}
}
@@ -58,6 +60,15 @@ module.controller('CategoryTreeCtrl',
return label;
}
$scope.formatFeedName = function(feed) {
console.log('cc')
var label = feed.name;
if (feed.unread > 0) {
label = label + " (" + feed.unread + ")";
}
return label;
}
$scope.feedClicked = function(id) {
$location.path('/feeds/view/feed/' + id);
};