summaryrefslogtreecommitdiffstats
path: root/js/controller
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/controller
parent32f2759945521129e00a7cd4933682ff63d9440f (diff)
add active and unread stuff
Diffstat (limited to 'js/controller')
-rw-r--r--js/controller/NavigationController.js92
1 files changed, 76 insertions, 16 deletions
diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js
index e6cb14a93..17ef923aa 100644
--- a/js/controller/NavigationController.js
+++ b/js/controller/NavigationController.js
@@ -8,7 +8,8 @@
* @copyright Bernhard Posselt 2014
*/
app.controller('NavigationController',
-function (FeedResource, FolderResource, ItemResource, SettingsResource) {
+function ($route, FEED_TYPE,
+ FeedResource, FolderResource, ItemResource, SettingsResource) {
'use strict';
this.feedError = '';
@@ -48,42 +49,101 @@ function (FeedResource, FolderResource, ItemResource, SettingsResource) {
return FeedResource.getByFolderId(folderId);
};
+ this.getUnreadCount = () => {
+ return FeedResource.getUnreadCount();
+ };
+
+ this.getFeedUnreadCount = (feedId) => {
+ return FeedResource.getById(feedId).unreadCount;
+ };
+
+ this.getFolderUnreadCount= (folderId) => {
+ return FeedResource.getFolderUnreadCount(folderId);
+ };
+
+ this.getStarredCount = () => {
+ return ItemResource.getStarredCount();
+ };
+
+ this.toggleFolder = (folderName) => {
+ FolderResource.toggleOpen(folderName);
+ };
+
+ this.hasFeeds = (folderId) => {
+ return FeedResource.getFolderUnreadCount(folderId) !== undefined;
+ };
+
+ this.subFeedActive = (folderId) => {
+ let type = $route.current.$$route.type;
+
+ if (type === FEED_TYPE.FEED) {
+ let feed = FeedResource.getById($route.current.params.id);
+
+ if (feed.folderId === folderId) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ this.isSubscriptionsActive = () => {
+ return $route.current.$$route.type === FEED_TYPE.SUBSCRIPTIONS;
+ };
+
+ this.isStarredActive = () => {
+ return $route.current.$$route.type === FEED_TYPE.STARRED;
+ };
+
+ this.isFolderActive = (folderId) => {
+ return $route.current.$$route.type === FEED_TYPE.FOLDER &&
+ $route.current.params.id === folderId;
+ };
+
+ this.isFeedActive = (feedId) => {
+ return $route.current.$$route.type === FEED_TYPE.FEED &&
+ $route.current.params.id === feedId;
+ };
+
// TBD
- this.createFeed = () => {
- console.log('TBD');
+ this.isAddingFolder = () => {
+ return true;
};
- this.createFolder = () => {
- console.log('TBD');
+ this.createFeed = (feedUrl, folderId) => {
+ console.log(feedUrl + folderId);
};
- this.renameFeed = () => {
- console.log('TBD');
+ this.createFolder = (folderName) => {
+ console.log(folderName);
};
- this.renameFolder = () => {
- console.log('TBD');
+ this.cancelRenameFolder = (folderId) => {
+ console.log(folderId);
};
- this.deleteFeed = () => {
- console.log('TBD');
+ this.renameFeed = (feedId, feedTitle) => {
+ console.log(feedId + feedTitle);
};
- this.deleteFolder = () => {
- console.log('TBD');
+ this.cancelRenameFeed = (feedId) => {
+ console.log(feedId);
};
- this.moveFeed = () => {
+ this.renameFolder = () => {
console.log('TBD');
};
- this.isActive = () => {
+ this.deleteFeed = () => {
console.log('TBD');
};
- this.isVisible = () => {
+ this.deleteFolder = () => {
console.log('TBD');
};
+ this.moveFeed = () => {
+ console.log('TBD');
+ };
}); \ No newline at end of file