diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-11 20:56:23 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-11 20:56:23 +0200 |
commit | b06fc20ddbadbc7522cd23a83a20975f43889890 (patch) | |
tree | 252ddf454899920771466aa7d5b6376461c386e9 /js/app | |
parent | ce6b20c59e1140867f2353361d3524e3baeb4580 (diff) |
allow users to discard folder and feed errors
Diffstat (limited to 'js/app')
-rw-r--r-- | js/app/controllers/feedcontroller.coffee | 2 | ||||
-rw-r--r-- | js/app/services/bl/feedbl.coffee | 6 | ||||
-rw-r--r-- | js/app/services/bl/folderbl.coffee | 4 | ||||
-rw-r--r-- | js/app/services/models/feedmodel.coffee | 20 | ||||
-rw-r--r-- | js/app/services/models/foldermodel.coffee | 22 |
5 files changed, 53 insertions, 1 deletions
diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee index 5299ead03..27432e33f 100644 --- a/js/app/controllers/feedcontroller.coffee +++ b/js/app/controllers/feedcontroller.coffee @@ -68,6 +68,7 @@ angular.module('News').factory '_FeedController', @_$scope.feedExistsError = true else @_$scope.feedEmptyError = true + @_isAddingFeed = false @_$scope.addFolder = (folderName) => @@ -92,6 +93,7 @@ angular.module('News').factory '_FeedController', @_$scope.folderExistsError = true else @_$scope.folderEmptyError = true + @_isAddingFolder = false @_$scope.$on 'moveFeedToFolder', (scope, data) => diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee index ef4fbac1c..6ab3c54e5 100644 --- a/js/app/services/bl/feedbl.coffee +++ b/js/app/services/bl/feedbl.coffee @@ -156,7 +156,11 @@ NewLoading, _ExistsError) -> else onSuccess(response.data) - @_persistence.createFeed url, parentId, success + @_persistence.createFeed(url, parentId, success) + + + markErrorRead: (urlHash) -> + @_feedModel.removeByUrlHash(urlHash) return new FeedBl(ShowAll, FeedModel, Persistence, ActiveFeed, FeedType, diff --git a/js/app/services/bl/folderbl.coffee b/js/app/services/bl/folderbl.coffee index 20f545e43..1084dd5b7 100644 --- a/js/app/services/bl/folderbl.coffee +++ b/js/app/services/bl/folderbl.coffee @@ -108,6 +108,10 @@ ItemModel, ShowAll, _ExistsError)-> @_persistence.createFolder folderName, 0, success + markErrorRead: (folderName) -> + @_folderModel.removeByName(folderName) + + return new FolderBl(FolderModel, FeedBl, ShowAll, ActiveFeed, Persistence, FeedType, ItemModel) diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee index 5c4473b3a..405ea2651 100644 --- a/js/app/services/models/feedmodel.coffee +++ b/js/app/services/models/feedmodel.coffee @@ -144,5 +144,25 @@ angular.module('News').factory '_FeedModel', return @get(query) + removeByUrlHash: (urlHash, clearCache=true) -> + ### + Remove an entry by id + ### + + # remove from data map + for key, value of @_dataMap + if @_dataMap[key].urlHash == urlHash + delete @_dataMap[key] + break + + for entry, counter in @_data + if entry.urlHash == urlHash + @_data.splice(counter, 1) + delete @_urlHash[urlHash] + + if clearCache + @_invalidateCache() + break + return FeedModel ]
\ No newline at end of file diff --git a/js/app/services/models/foldermodel.coffee b/js/app/services/models/foldermodel.coffee index eb1059fc8..5dad0bdae 100644 --- a/js/app/services/models/foldermodel.coffee +++ b/js/app/services/models/foldermodel.coffee @@ -116,5 +116,27 @@ angular.module('News').factory '_FolderModel', return folderName.trim().toLowerCase() + removeByName: (name, clearCache=true) -> + ### + Remove an entry by id + ### + name = name.toLowerCase() + + # remove from data map + for key, value of @_dataMap + if @_dataMap[key].name == name + delete @_dataMap[key] + break + + for entry, counter in @_data + if entry.name == name + @_data.splice(counter, 1) + delete @_nameCache[name] + + if clearCache + @_invalidateCache() + break + + return FolderModel ]
\ No newline at end of file |