summaryrefslogtreecommitdiffstats
path: root/js/app
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-11 21:38:20 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-11 21:38:20 +0200
commiteda8fec5874ebd2ba48b458497cb315eb871105c (patch)
treeb801eee009361a7e965d205de9d792498eb8d1fa /js/app
parentb06fc20ddbadbc7522cd23a83a20975f43889890 (diff)
autoselect folder when it was created and open folder if a feed gets added to it
Diffstat (limited to 'js/app')
-rw-r--r--js/app/controllers/feedcontroller.coffee8
-rw-r--r--js/app/services/bl/feedbl.coffee1
-rw-r--r--js/app/services/bl/folderbl.coffee13
3 files changed, 20 insertions, 2 deletions
diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee
index 27432e33f..8f9f4e7b6 100644
--- a/js/app/controllers/feedcontroller.coffee
+++ b/js/app/controllers/feedcontroller.coffee
@@ -53,6 +53,9 @@ angular.module('News').factory '_FeedController',
try
@_isAddingFeed = true
+ # set folder to open
+ if parentFolderId != 0
+ @_folderBl.open(parentFolderId)
@_feedBl.create feedUrl, parentFolderId
# on success
, (data) =>
@@ -80,10 +83,12 @@ angular.module('News').factory '_FeedController',
@_folderBl.create folderName
# on success
- , =>
+ , (data) =>
@_$scope.folderName = ''
@_$scope.addNewFolder = false
@_isAddingFolder = false
+ activeId = data['folders'][0].id
+ @_$scope.folderId = @_folderBl.getById(activeId)
# on error
, =>
@_isAddingFolder = false
@@ -94,6 +99,7 @@ angular.module('News').factory '_FeedController',
else
@_$scope.folderEmptyError = true
@_isAddingFolder = false
+ @_$scope.addNewFolder = true
@_$scope.$on 'moveFeedToFolder', (scope, data) =>
diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee
index 6ab3c54e5..4c9ff7c99 100644
--- a/js/app/services/bl/feedbl.coffee
+++ b/js/app/services/bl/feedbl.coffee
@@ -146,6 +146,7 @@ NewLoading, _ExistsError) ->
url: url
urlHash: urlHash
folderId: parentId
+ unreadCount: 0
@_feedModel.add(feed)
diff --git a/js/app/services/bl/folderbl.coffee b/js/app/services/bl/folderbl.coffee
index 1084dd5b7..ddb1f88c4 100644
--- a/js/app/services/bl/folderbl.coffee
+++ b/js/app/services/bl/folderbl.coffee
@@ -34,6 +34,9 @@ ItemModel, ShowAll, _ExistsError)->
super(activeFeed, persistence, itemModel, @_feedType.Folder)
+ getById: (folderId) ->
+ return @_folderModel.getById(folderId)
+
delete: (folderId) ->
@_folderModel.removeById(folderId)
@_persistence.deleteFolder(folderId)
@@ -43,6 +46,14 @@ ItemModel, ShowAll, _ExistsError)->
return @_feedBl.getFeedsOfFolder(folderId).length
+ open: (folderId) ->
+ folder = @_folderModel.getById(folderId)
+ if angular.isDefined(folder)
+ if not folder.opened
+ folder.opened = true
+ @_persistence.openFolder(folder.id)
+
+
toggleFolder: (folderId) ->
folder = @_folderModel.getById(folderId)
@@ -103,7 +114,7 @@ ItemModel, ShowAll, _ExistsError)->
folder.error = response.msg
onFailure()
else
- onSuccess()
+ onSuccess(response.data)
@_persistence.createFolder folderName, 0, success