summaryrefslogtreecommitdiffstats
path: root/js/app/services
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2013-12-19 15:15:32 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2013-12-19 15:15:32 +0100
commit6dc8dad23eea121989e0a89a67e92091802857a0 (patch)
tree15d6b5eda5fece8bf691d5ef8662f697b56b7073 /js/app/services
parent28d28d8c9eb5ed9f184b572cfd16994c024e4227 (diff)
add persistent option for compact view
Diffstat (limited to 'js/app/services')
-rw-r--r--js/app/services/compact.coffee38
-rw-r--r--js/app/services/persistence.coffee16
-rw-r--r--js/app/services/services.coffee5
3 files changed, 57 insertions, 2 deletions
diff --git a/js/app/services/compact.coffee b/js/app/services/compact.coffee
new file mode 100644
index 000000000..55f96fb59
--- /dev/null
+++ b/js/app/services/compact.coffee
@@ -0,0 +1,38 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+angular.module('News').factory 'Compact', ->
+
+ class Compact
+
+ constructor: ->
+ @_compact = false
+
+ isCompact: ->
+ return @_compact
+
+ handle: (data) ->
+ @_compact = data
+
+
+ return new Compact()
+
diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee
index 6bf040e07..05558b3e1 100644
--- a/js/app/services/persistence.coffee
+++ b/js/app/services/persistence.coffee
@@ -51,6 +51,7 @@ $rootScope, $q) ->
@getAllFeeds(successCallback)
@userSettingsRead()
@userSettingsLanguage()
+ @userSettingsIsCompact()
@deferred.promise
@@ -474,6 +475,21 @@ $rootScope, $q) ->
@_request.get 'news_usersettings_language', data
+ userSettingsIsCompact: ->
+ @_request.get 'news_usersettings_iscompact'
+
+
+ userSettingsSetCompact: (isCompact) ->
+ ###
+ sets all items of a folder as read
+ ###
+ params =
+ data:
+ compact: isCompact
+
+ @_request.post 'news_usersettings_setcompact', params
+
+
_triggerHideRead: ->
@_$rootScope.$broadcast('triggerHideRead')
diff --git a/js/app/services/services.coffee b/js/app/services/services.coffee
index a5297f0a1..1a7633d42 100644
--- a/js/app/services/services.coffee
+++ b/js/app/services/services.coffee
@@ -45,9 +45,9 @@ angular.module('News').factory 'NewLoading', ['_Loading', (_Loading) ->
angular.module('News').factory 'Publisher',
['_Publisher', 'ActiveFeed', 'ShowAll', 'StarredCount', 'ItemModel',
-'FolderModel', 'FeedModel', 'Language', 'NewestItem',
+'FolderModel', 'FeedModel', 'Language', 'NewestItem', 'Compact',
(_Publisher, ActiveFeed, ShowAll, StarredCount, ItemModel,
-FolderModel, FeedModel, Language, NewestItem) ->
+FolderModel, FeedModel, Language, NewestItem, Compact) ->
# register items at publisher to automatically add incoming items
publisher = new _Publisher()
@@ -59,6 +59,7 @@ FolderModel, FeedModel, Language, NewestItem) ->
publisher.subscribeObjectTo(FeedModel, 'feeds')
publisher.subscribeObjectTo(ItemModel, 'items')
publisher.subscribeObjectTo(NewestItem, 'newestItemId')
+ publisher.subscribeObjectTo(Compact, 'compact')
return publisher
]