summaryrefslogtreecommitdiffstats
path: root/js/app
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-18 16:08:22 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-18 16:08:22 +0200
commitfd8a57477e76ee670338885f5a79fbda1f1391bd (patch)
treee61e98023a339cd95ab263a5a896d54358b4fc28 /js/app
parentdaa2c7dea555b334ffb7516f8af64ad1d090f39b (diff)
show unread count in title, fix #64
Diffstat (limited to 'js/app')
-rw-r--r--js/app/controllers/feedcontroller.coffee21
1 files changed, 17 insertions, 4 deletions
diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee
index 88a5d1c88..8633845e5 100644
--- a/js/app/controllers/feedcontroller.coffee
+++ b/js/app/controllers/feedcontroller.coffee
@@ -24,10 +24,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').controller 'FeedController',
['$scope', '_ExistsError', 'Persistence', 'FolderBusinessLayer',
'FeedBusinessLayer', 'SubscriptionsBusinessLayer', 'StarredBusinessLayer',
-'unreadCountFormatter', 'ActiveFeed', 'FeedType',
+'unreadCountFormatter', 'ActiveFeed', 'FeedType', '$window',
($scope, _ExistsError, Persistence, FolderBusinessLayer, FeedBusinessLayer,
SubscriptionsBusinessLayer, StarredBusinessLayer, unreadCountFormatter,
-ActiveFeed, FeedType) ->
+ActiveFeed, FeedType, $window) ->
class FeedController
@@ -35,7 +35,7 @@ ActiveFeed, FeedType) ->
constructor: (@_$scope, @_persistence, @_folderBusinessLayer,
@_feedBusinessLayer, @_subscriptionsBusinessLayer,
@_starredBusinessLayer, @_unreadCountFormatter,
- @_activeFeed, @_feedType) ->
+ @_activeFeed, @_feedType, @_$window) ->
@_isAddingFolder = false
@_isAddingFeed = false
@@ -47,6 +47,19 @@ ActiveFeed, FeedType) ->
@_$scope.starredBusinessLayer = @_starredBusinessLayer
@_$scope.unreadCountFormatter = @_unreadCountFormatter
+ @_$scope.getTotalUnreadCount = =>
+ # also update title based on unreadcount
+ count = @_subscriptionsBusinessLayer.getUnreadCount(0)
+
+ # dont do this for other dom elements
+ # the title is some kind of exception since its always there
+ # and it has nothing to do with the body structure
+ if count > 0
+ @_$window.document.title = 'News (' + count + ') | ownCloud'
+ else
+ @_$window.document.title = 'News | ownCloud'
+ return count
+
@_$scope.isAddingFolder = =>
return @_isAddingFolder
@@ -116,6 +129,6 @@ ActiveFeed, FeedType) ->
return new FeedController($scope, Persistence, FolderBusinessLayer,
FeedBusinessLayer, SubscriptionsBusinessLayer,
StarredBusinessLayer, unreadCountFormatter,
- ActiveFeed, FeedType)
+ ActiveFeed, FeedType, $window)
] \ No newline at end of file