summaryrefslogtreecommitdiffstats
path: root/js/build
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-31 01:12:20 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-31 01:12:20 +0200
commit82f0a877a001ead0bd0cdd76d96fe46a071535d8 (patch)
treea37f50a00c77c5e6afd1790ccde75ab3639c6c96 /js/build
parent32f2759945521129e00a7cd4933682ff63d9440f (diff)
add active and unread stuff
Diffstat (limited to 'js/build')
-rw-r--r--js/build/app.js86
1 files changed, 72 insertions, 14 deletions
diff --git a/js/build/app.js b/js/build/app.js
index c482c3fb4..9d544268f 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -293,11 +293,13 @@ var $__build_47_app__ = function () {
}
]);
app.controller('NavigationController', [
+ '$route',
+ 'FEED_TYPE',
'FeedResource',
'FolderResource',
'ItemResource',
'SettingsResource',
- function (FeedResource, FolderResource, ItemResource, SettingsResource) {
+ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, SettingsResource) {
'use strict';
this.feedError = '';
this.folderError = '';
@@ -334,14 +336,67 @@ var $__build_47_app__ = function () {
this.getFeedsOfFolder = function (folderId) {
return FeedResource.getByFolderId(folderId);
};
- this.createFeed = function () {
- console.log('TBD');
+ this.getUnreadCount = function () {
+ return FeedResource.getUnreadCount();
};
- this.createFolder = function () {
- console.log('TBD');
+ this.getFeedUnreadCount = function (feedId) {
+ return FeedResource.getById(feedId).unreadCount;
};
- this.renameFeed = function () {
- console.log('TBD');
+ this.getFolderUnreadCount = function (folderId) {
+ return FeedResource.getFolderUnreadCount(folderId);
+ };
+ this.getStarredCount = function () {
+ return ItemResource.getStarredCount();
+ };
+ this.toggleFolder = function (folderName) {
+ FolderResource.toggleOpen(folderName);
+ };
+ this.hasFeeds = function (folderId) {
+ return FeedResource.getFolderUnreadCount(folderId) !== undefined;
+ };
+ this.subFeedActive = function (folderId) {
+ var type = $route.current.$$route.type;
+ if (type === FEED_TYPE.FEED) {
+ try {
+ throw undefined;
+ } catch (feed) {
+ feed = FeedResource.getById($route.current.params.id);
+ if (feed.folderId === folderId) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+ this.isSubscriptionsActive = function () {
+ return $route.current.$$route.type === FEED_TYPE.SUBSCRIPTIONS;
+ };
+ this.isStarredActive = function () {
+ return $route.current.$$route.type === FEED_TYPE.STARRED;
+ };
+ this.isFolderActive = function (folderId) {
+ return $route.current.$$route.type === FEED_TYPE.FOLDER && $route.current.params.id === folderId;
+ };
+ this.isFeedActive = function (feedId) {
+ return $route.current.$$route.type === FEED_TYPE.FEED && $route.current.params.id === feedId;
+ };
+ this.isAddingFolder = function () {
+ return true;
+ };
+ this.createFeed = function (feedUrl, folderId) {
+ console.log(feedUrl + folderId);
+ };
+ this.createFolder = function (folderName) {
+ console.log(folderName);
+ };
+ this.cancelRenameFolder = function (folderId) {
+ console.log(folderId);
+ };
+ this.renameFeed = function (feedId, feedTitle) {
+ console.log(feedId + feedTitle);
+ };
+ this.cancelRenameFeed = function (feedId) {
+ console.log(feedId);
};
this.renameFolder = function () {
console.log('TBD');
@@ -355,12 +410,6 @@ var $__build_47_app__ = function () {
this.moveFeed = function () {
console.log('TBD');
};
- this.isActive = function () {
- console.log('TBD');
- };
- this.isVisible = function () {
- console.log('TBD');
- };
}
]);
app.controller('SettingsController', [
@@ -408,6 +457,15 @@ var $__build_47_app__ = function () {
};
}
]);
+ app.filter('unreadCountFormatter', function () {
+ 'use strict';
+ return function (unreadCount) {
+ if (unreadCount > 999) {
+ return '999+';
+ }
+ return unreadCount;
+ };
+ });
app.factory('FeedResource', [
'Resource',
'$http',
@@ -541,7 +599,7 @@ var $__build_47_app__ = function () {
return this.unreadCount;
},
getFolderUnreadCount: function (folderId) {
- return this.folderUnreadCount[$traceurRuntime.toProperty(folderId)] || 0;
+ return this.folderUnreadCount[$traceurRuntime.toProperty(folderId)];
},
getByFolderId: function (folderId) {
return this.folderIds[$traceurRuntime.toProperty(folderId)] || [];