summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-25 22:30:52 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-25 22:30:52 +0100
commit79105cc75673def0a7453b4a14fd7453e02a2d45 (patch)
tree31626a72430a83b8e882e127c73a7c5e00b7966a /js
parent3a237701e0c9ea8ea2bc4f5e6e4ac840282ab5fa (diff)
setting read and unread works now
Diffstat (limited to 'js')
-rw-r--r--js/app/services/models/feedmodel.coffee3
-rw-r--r--js/app/services/persistence.coffee4
-rw-r--r--js/public/app.js9
3 files changed, 12 insertions, 4 deletions
diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee
index 838f240c1..def720edf 100644
--- a/js/app/services/models/feedmodel.coffee
+++ b/js/app/services/models/feedmodel.coffee
@@ -47,8 +47,9 @@ angular.module('News').factory '_FeedModel',
getFeedUnreadCount: (feedId) ->
feed = @getById(feedId)
+ count = 0
if angular.isDefined(feed)
- return feed.unreadCount
+ return count += feed.unreadCount
else
return 0
diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee
index fab268518..200145c71 100644
--- a/js/app/services/persistence.coffee
+++ b/js/app/services/persistence.coffee
@@ -52,7 +52,9 @@ angular.module('News').factory '_Persistence', ->
###
ITEM CONTROLLER
###
- getItems: (type, id, offset, onSuccess, updatedSince=null) ->
+ getItems: (type, id, offset, onSuccess=null, updatedSince=null) ->
+
+ onSuccess or= ->
if updatedSince != null
data =
diff --git a/js/public/app.js b/js/public/app.js
index d8303f06f..375b02554 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -553,10 +553,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
FeedModel.prototype.getFeedUnreadCount = function(feedId) {
- var feed;
+ var count, feed;
feed = this.getById(feedId);
+ count = 0;
if (angular.isDefined(feed)) {
- return feed.unreadCount;
+ return count += feed.unreadCount;
} else {
return 0;
}
@@ -890,9 +891,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) {
var data, params;
+ if (onSuccess == null) {
+ onSuccess = null;
+ }
if (updatedSince == null) {
updatedSince = null;
}
+ onSuccess || (onSuccess = function() {});
if (updatedSince !== null) {
data = {
updatedSince: updatedSince,