diff options
-rw-r--r-- | controller/pagecontroller.php | 11 | ||||
-rw-r--r-- | js/app/controllers/itemcontroller.coffee | 10 | ||||
-rw-r--r-- | js/app/controllers/settingscontroller.coffee | 19 | ||||
-rw-r--r-- | js/app/services/businesslayer/feedbusinesslayer.coffee | 20 | ||||
-rw-r--r-- | js/app/services/businesslayer/folderbusinesslayer.coffee | 10 | ||||
-rw-r--r-- | js/app/services/compact.coffee | 38 | ||||
-rw-r--r-- | js/app/services/persistence.coffee | 28 | ||||
-rw-r--r-- | js/app/services/services.coffee | 11 | ||||
-rw-r--r-- | js/app/services/settings.coffee (renamed from js/app/services/language.coffee) | 40 | ||||
-rw-r--r-- | js/app/services/showall.coffee | 44 | ||||
-rw-r--r-- | js/public/app.js | 249 | ||||
-rw-r--r-- | js/tests/services/compactSpec.coffee | 44 | ||||
-rw-r--r-- | js/tests/services/languageSpec.coffee | 103 | ||||
-rw-r--r-- | js/tests/services/showallSpec.coffee | 45 | ||||
-rw-r--r-- | templates/part.settings.php | 10 | ||||
-rw-r--r-- | tests/unit/controller/PageControllerTest.php | 16 |
16 files changed, 136 insertions, 562 deletions
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index db0fa48bf..2e9377a7e 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -51,7 +51,7 @@ class PageController extends Controller { * @NoAdminRequired */ public function settings() { - $settings = ['showAll', 'compact', 'readOnScroll', 'oldestFirst']; + $settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst']; $result = ['language' => $this->l10n->getLanguageCode()]; @@ -60,8 +60,7 @@ class PageController extends Controller { $this->userId, $this->appName, $setting ) === '1'; } - - return $result; + return ['settings' => $result]; } @@ -70,11 +69,11 @@ class PageController extends Controller { * * @param bool $showAll * @param bool $compact - * @param bool $readOnScroll + * @param bool $preventReadOnScroll * @param bool $oldestFirst */ - public function updateSettings($showAll, $compact, $readOnScroll, $oldestFirst) { - $settings = ['showAll', 'compact', 'readOnScroll', 'oldestFirst']; + public function updateSettings($showAll, $compact, $preventReadOnScroll, $oldestFirst) { + $settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst']; foreach ($settings as $setting) { if(${$setting} !== null) { diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee index f381baede..94c3cd159 100644 --- a/js/app/controllers/itemcontroller.coffee +++ b/js/app/controllers/itemcontroller.coffee @@ -23,15 +23,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').controller 'ItemController', ['$scope', 'ItemBusinessLayer', 'FeedModel', 'FeedLoading', 'FeedBusinessLayer', -'Language', 'AutoPageLoading', 'Compact', +'Language', 'AutoPageLoading', 'Settings', ($scope, ItemBusinessLayer, FeedModel, FeedLoading, FeedBusinessLayer, -Language, AutoPageLoading, Compact) -> +Language, AutoPageLoading, Settings) -> class ItemController constructor: (@_$scope, @_itemBusinessLayer, @_feedModel, @_feedLoading, @_autoPageLoading, @_feedBusinessLayer, - @_language, @_compact) -> + @_language, @_settings) -> @_autoPaging = true @_$scope.itemBusinessLayer = @_itemBusinessLayer @@ -75,10 +75,10 @@ Language, AutoPageLoading, Compact) -> @_$scope.isCompactView = => - return @_compact.isCompact() + return @_settings.get('compact') return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading, AutoPageLoading, FeedBusinessLayer, Language, - Compact) + Settings) ]
\ No newline at end of file diff --git a/js/app/controllers/settingscontroller.coffee b/js/app/controllers/settingscontroller.coffee index 66f7f8824..9190ebad5 100644 --- a/js/app/controllers/settingscontroller.coffee +++ b/js/app/controllers/settingscontroller.coffee @@ -22,16 +22,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').controller 'SettingsController', -['$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'ShowAll', -'Persistence', 'Compact', -($scope, FeedBusinessLayer, FolderBusinessLayer, ShowAll, Persistence, -Compact) -> +['$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'Persistence', 'Settings', +($scope, FeedBusinessLayer, FolderBusinessLayer, Persistence, Settings) -> $scope.feedBusinessLayer = FeedBusinessLayer $scope.import = (fileContent) -> $scope.error = false - ShowAll.setShowAll(true) + Settings.set('showAll', true) try FolderBusinessLayer.import(fileContent) @@ -52,12 +50,11 @@ Compact) -> $scope.loading = false - $scope.setCompactView = (isCompact) -> - Compact.handle(!Compact.isCompact()) + $scope.toggleSetting = (key) -> + Settings.set(key, !Settings.get(key)) + Persistence.setSettings(Settings.getSettings()) - Persistence.userSettingsSetCompact(Compact.isCompact()) - - $scope.isCompactView = -> - return Compact.isCompact() + $scope.getSetting = (key) -> + return Settings.get(key) ]
\ No newline at end of file diff --git a/js/app/services/businesslayer/feedbusinesslayer.coffee b/js/app/services/businesslayer/feedbusinesslayer.coffee index 2700caeb5..c82b7de87 100644 --- a/js/app/services/businesslayer/feedbusinesslayer.coffee +++ b/js/app/services/businesslayer/feedbusinesslayer.coffee @@ -22,15 +22,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory 'FeedBusinessLayer', -['_BusinessLayer', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', +['_BusinessLayer', 'Settings', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', '_ExistsError', 'Utils', '$rootScope', 'NewestItem', -(_BusinessLayer, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, +(_BusinessLayer, Settings, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)-> class FeedBusinessLayer extends _BusinessLayer - constructor: (@_showAll, @_feedModel, persistence, activeFeed, feedType, + constructor: (@_settings, @_feedModel, persistence, activeFeed, feedType, itemModel, @_newLoading, @_utils, $rootScope, @_newestItem) -> super(activeFeed, persistence, itemModel, feedType.Feed, $rootScope) @@ -94,7 +94,7 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)-> isVisible: (feedId) -> - if @isActive(feedId) or @_showAll.getShowAll() + if @isActive(feedId) or @_settings.get('showAll') return true else return @_feedModel.getFeedUnreadCount(feedId) > 0 @@ -111,7 +111,7 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)-> setShowAll: (showAll) -> - @_showAll.setShowAll(showAll) + @_settings.set('showAll', showAll) # TODO: this callback is not tested with a unittest callback = => @@ -124,14 +124,12 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)-> => @_newLoading.decrease() ) - if showAll - @_persistence.userSettingsReadShow(callback) - else - @_persistence.userSettingsReadHide(callback) + + @_persistence.setSettings(@_settings.getSettings(), callback) isShowAll: -> - return @_showAll.getShowAll() + return @_settings.get('showAll') getAll: -> @@ -189,7 +187,7 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)-> @_persistence.importArticles(json, onSuccess) - return new FeedBusinessLayer(ShowAll, FeedModel, Persistence, ActiveFeed, + return new FeedBusinessLayer(Settings, FeedModel, Persistence, ActiveFeed, FeedType, ItemModel, NewLoading, Utils, $rootScope, NewestItem) diff --git a/js/app/services/businesslayer/folderbusinesslayer.coffee b/js/app/services/businesslayer/folderbusinesslayer.coffee index 60bde1c4e..df2f80dd4 100644 --- a/js/app/services/businesslayer/folderbusinesslayer.coffee +++ b/js/app/services/businesslayer/folderbusinesslayer.coffee @@ -23,15 +23,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory 'FolderBusinessLayer', ['_BusinessLayer', 'FolderModel', 'FeedBusinessLayer', 'Persistence', -'FeedType', 'ActiveFeed', 'ItemModel', 'ShowAll', '_ExistsError', 'OPMLParser', +'FeedType', 'ActiveFeed', 'ItemModel', 'Settings', '_ExistsError', 'OPMLParser', 'NewestItem', 'FeedModel', '$rootScope', (_BusinessLayer, FolderModel, FeedBusinessLayer, Persistence, FeedType, -ActiveFeed, ItemModel, ShowAll, _ExistsError, OPMLParser, NewestItem, +ActiveFeed, ItemModel, Settings, _ExistsError, OPMLParser, NewestItem, FeedModel, $rootScope) -> class FolderBusinessLayer extends _BusinessLayer - constructor: (@_folderModel, @_feedBusinessLayer, @_showAll, activeFeed, + constructor: (@_folderModel, @_feedBusinessLayer, @_settings, activeFeed, persistence, @_feedType, itemModel, @_opmlParser, @_newestItem, @_feedModel, $rootScope) -> super(activeFeed, persistence, itemModel, @_feedType.Folder, $rootScope) @@ -105,7 +105,7 @@ FeedModel, $rootScope) -> isVisible: (folderId) -> - if @_showAll.getShowAll() || + if @_settings.get('showAll') || @_feedBusinessLayer.getFeedsOfFolder(folderId).length == 0 return true else @@ -201,7 +201,7 @@ FeedModel, $rootScope) -> console.info error - return new FolderBusinessLayer(FolderModel, FeedBusinessLayer, ShowAll, + return new FolderBusinessLayer(FolderModel, FeedBusinessLayer, Settings, ActiveFeed, Persistence, FeedType, ItemModel, OPMLParser, NewestItem, FeedModel, $rootScope) diff --git a/js/app/services/compact.coffee b/js/app/services/compact.coffee deleted file mode 100644 index 55f96fb59..000000000 --- a/js/app/services/compact.coffee +++ /dev/null @@ -1,38 +0,0 @@ -### - -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 4005cf56b..d24a82d62 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -440,34 +440,6 @@ $rootScope, $q) -> ### USERSETTINGS CONTROLLER ### - userSettingsReadShow: (callback) -> - ### - Sets the reader mode to show all - ### - data = - showAll: true - @setSettings data, callback - - - userSettingsReadHide: (callback) -> - ### - Sets the reader mode to show only unread - ### - data = - showAll: false - @setSettings data, callback - - - userSettingsSetCompact: (isCompact) -> - ### - sets all items of a folder as read - ### - data = - compact: isCompact - - @setSettings data - - setSettings: (settings, onSuccess) -> onSuccess or= -> data = diff --git a/js/app/services/services.coffee b/js/app/services/services.coffee index bc9c32cd2..2fd8eee01 100644 --- a/js/app/services/services.coffee +++ b/js/app/services/services.coffee @@ -44,22 +44,21 @@ angular.module('News').factory 'NewLoading', ['_Loading', (_Loading) -> angular.module('News').factory 'Publisher', -['_Publisher', 'ActiveFeed', 'ShowAll', 'StarredCount', 'ItemModel', -'FolderModel', 'FeedModel', 'Language', 'NewestItem', 'Compact', -(_Publisher, ActiveFeed, ShowAll, StarredCount, ItemModel, -FolderModel, FeedModel, Language, NewestItem, Compact) -> +['_Publisher', 'ActiveFeed', 'StarredCount', 'ItemModel', +'FolderModel', 'FeedModel', 'Language', 'NewestItem', 'Settings', +(_Publisher, ActiveFeed, StarredCount, ItemModel, +FolderModel, FeedModel, Language, NewestItem, Settings) -> # register items at publisher to automatically add incoming items publisher = new _Publisher() publisher.subscribeObjectTo(ActiveFeed, 'activeFeed') - publisher.subscribeObjectTo(ShowAll, 'showAll') publisher.subscribeObjectTo(Language, 'language') publisher.subscribeObjectTo(StarredCount, 'starred') publisher.subscribeObjectTo(FolderModel, 'folders') publisher.subscribeObjectTo(FeedModel, 'feeds') publisher.subscribeObjectTo(ItemModel, 'items') publisher.subscribeObjectTo(NewestItem, 'newestItemId') - publisher.subscribeObjectTo(Compact, 'compact') + publisher.subscribeObjectTo(Settings, 'settings') return publisher ] diff --git a/js/app/services/language.coffee b/js/app/services/settings.coffee index b05387689..8497f13a6 100644 --- a/js/app/services/language.coffee +++ b/js/app/services/settings.coffee @@ -20,12 +20,16 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory 'Language', -> +angular.module('News').factory 'Settings', -> - class Language + class Settings constructor: -> - @_language = 'en' + @_settings = + compact: false + preventReadOnScroll: false + oldestFirst: false + language: 'en' @_langs = [ 'ar-ma' 'ar' @@ -77,28 +81,28 @@ angular.module('News').factory 'Language', -> 'zh-tw' ] + get: (key) -> + return @_settings[key] + + set: (key, value) -> + @_settings[key] = value + + getSettings: -> + return @_settings handle: (data) -> # fix broken server locales - data = data.replace('_', '-').toLowerCase() + language = data.language.replace('_', '-').toLowerCase() # check if the first part is available, if so use this - if not (data in @_langs) - data = data.split('-')[0] + if not (language in @_langs) + language = language.split('-')[0] # if its not available default to english - if not (data in @_langs) - data = 'en' - - @_language = data - - - getLanguage: -> - return @_language - + if not (language in @_langs) + language = 'en' - getMomentFromTimestamp: (timestamp) -> - return moment.unix(timestamp).lang(@_language) + @_settings = data - return new Language() + return new Settings()
\ No newline at end of file diff --git a/js/app/services/showall.coffee b/js/app/services/showall.coffee deleted file mode 100644 index ec4795f80..000000000 --- a/js/app/services/showall.coffee +++ /dev/null @@ -1,44 +0,0 @@ -### - -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 'ShowAll', -> - - class ShowAll - - constructor: -> - @_showAll = false - - - handle: (data) -> - @_showAll = data - - - getShowAll: -> - return @_showAll - - - setShowAll: (showAll) -> - @_showAll = showAll - - - return new ShowAll() diff --git a/js/public/app.js b/js/public/app.js index 608fdb4d7..0396e6d71 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -1200,10 +1200,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News').controller('ItemController', [ - '$scope', 'ItemBusinessLayer', 'FeedModel', 'FeedLoading', 'FeedBusinessLayer', 'Language', 'AutoPageLoading', 'Compact', function($scope, ItemBusinessLayer, FeedModel, FeedLoading, FeedBusinessLayer, Language, AutoPageLoading, Compact) { + '$scope', 'ItemBusinessLayer', 'FeedModel', 'FeedLoading', 'FeedBusinessLayer', 'Language', 'AutoPageLoading', 'Settings', function($scope, ItemBusinessLayer, FeedModel, FeedLoading, FeedBusinessLayer, Language, AutoPageLoading, Settings) { var ItemController; ItemController = (function() { - function ItemController(_$scope, _itemBusinessLayer, _feedModel, _feedLoading, _autoPageLoading, _feedBusinessLayer, _language, _compact) { + function ItemController(_$scope, _itemBusinessLayer, _feedModel, _feedLoading, _autoPageLoading, _feedBusinessLayer, _language, _settings) { this._$scope = _$scope; this._itemBusinessLayer = _itemBusinessLayer; this._feedModel = _feedModel; @@ -1211,7 +1211,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. this._autoPageLoading = _autoPageLoading; this._feedBusinessLayer = _feedBusinessLayer; this._language = _language; - this._compact = _compact; + this._settings = _settings; this._autoPaging = true; this._$scope.itemBusinessLayer = this._itemBusinessLayer; this._$scope.feedBusinessLayer = this._feedBusinessLayer; @@ -1270,7 +1270,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. })(this)); this._$scope.isCompactView = (function(_this) { return function() { - return _this._compact.isCompact(); + return _this._settings.get('compact'); }; })(this); } @@ -1278,7 +1278,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return ItemController; })(); - return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading, AutoPageLoading, FeedBusinessLayer, Language, Compact); + return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading, AutoPageLoading, FeedBusinessLayer, Language, Settings); } ]); @@ -1309,12 +1309,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News').controller('SettingsController', [ - '$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'ShowAll', 'Persistence', 'Compact', function($scope, FeedBusinessLayer, FolderBusinessLayer, ShowAll, Persistence, Compact) { + '$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'Persistence', 'Settings', function($scope, FeedBusinessLayer, FolderBusinessLayer, Persistence, Settings) { $scope.feedBusinessLayer = FeedBusinessLayer; $scope["import"] = function(fileContent) { var error; $scope.error = false; - ShowAll.setShowAll(true); + Settings.set('showAll', true); try { return FolderBusinessLayer["import"](fileContent); } catch (_error) { @@ -1337,12 +1337,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return $scope.loading = false; } }; - $scope.setCompactView = function(isCompact) { - Compact.handle(!Compact.isCompact()); - return Persistence.userSettingsSetCompact(Compact.isCompact()); + $scope.toggleSetting = function(key) { + Settings.set(key, !Settings.get(key)); + return Persistence.setSettings(Settings.getSettings()); }; - return $scope.isCompactView = function() { - return Compact.isCompact(); + return $scope.getSetting = function(key) { + return Settings.get(key); }; } ]); @@ -1495,13 +1495,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; angular.module('News').factory('FeedBusinessLayer', [ - '_BusinessLayer', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', '_ExistsError', 'Utils', '$rootScope', 'NewestItem', function(_BusinessLayer, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem) { + '_BusinessLayer', 'Settings', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', '_ExistsError', 'Utils', '$rootScope', 'NewestItem', function(_BusinessLayer, Settings, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem) { var FeedBusinessLayer; FeedBusinessLayer = (function(_super) { __extends(FeedBusinessLayer, _super); - function FeedBusinessLayer(_showAll, _feedModel, persistence, activeFeed, feedType, itemModel, _newLoading, _utils, $rootScope, _newestItem) { - this._showAll = _showAll; + function FeedBusinessLayer(_settings, _feedModel, persistence, activeFeed, feedType, itemModel, _newLoading, _utils, $rootScope, _newestItem) { + this._settings = _settings; this._feedModel = _feedModel; this._newLoading = _newLoading; this._utils = _utils; @@ -1578,7 +1578,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; FeedBusinessLayer.prototype.isVisible = function(feedId) { - if (this.isActive(feedId) || this._showAll.getShowAll()) { + if (this.isActive(feedId) || this._settings.get('showAll')) { return true; } else { return this._feedModel.getFeedUnreadCount(feedId) > 0; @@ -1600,7 +1600,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.setShowAll = function(showAll) { var callback; - this._showAll.setShowAll(showAll); + this._settings.set('showAll', showAll); callback = (function(_this) { return function() { _this._itemModel.clear(); @@ -1610,15 +1610,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }); }; })(this); - if (showAll) { - return this._persistence.userSettingsReadShow(callback); - } else { - return this._persistence.userSettingsReadHide(callback); - } + return this._persistence.setSettings(this._settings.getSettings(), callback); }; FeedBusinessLayer.prototype.isShowAll = function() { - return this._showAll.getShowAll(); + return this._settings.get('showAll'); }; FeedBusinessLayer.prototype.getAll = function() { @@ -1690,7 +1686,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return FeedBusinessLayer; })(_BusinessLayer); - return new FeedBusinessLayer(ShowAll, FeedModel, Persistence, ActiveFeed, FeedType, ItemModel, NewLoading, Utils, $rootScope, NewestItem); + return new FeedBusinessLayer(Settings, FeedModel, Persistence, ActiveFeed, FeedType, ItemModel, NewLoading, Utils, $rootScope, NewestItem); } ]); @@ -1724,15 +1720,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; angular.module('News').factory('FolderBusinessLayer', [ - '_BusinessLayer', 'FolderModel', 'FeedBusinessLayer', 'Persistence', 'FeedType', 'ActiveFeed', 'ItemModel', 'ShowAll', '_ExistsError', 'OPMLParser', 'NewestItem', 'FeedModel', '$rootScope', function(_BusinessLayer, FolderModel, FeedBusinessLayer, Persistence, FeedType, ActiveFeed, ItemModel, ShowAll, _ExistsError, OPMLParser, NewestItem, FeedModel, $rootScope) { + '_BusinessLayer', 'FolderModel', 'FeedBusinessLayer', 'Persistence', 'FeedType', 'ActiveFeed', 'ItemModel', 'Settings', '_ExistsError', 'OPMLParser', 'NewestItem', 'FeedModel', '$rootScope', function(_BusinessLayer, FolderModel, FeedBusinessLayer, Persistence, FeedType, ActiveFeed, ItemModel, Settings, _ExistsError, OPMLParser, NewestItem, FeedModel, $rootScope) { var FolderBusinessLayer; FolderBusinessLayer = (function(_super) { __extends(FolderBusinessLayer, _super); - function FolderBusinessLayer(_folderModel, _feedBusinessLayer, _showAll, activeFeed, persistence, _feedType, itemModel, _opmlParser, _newestItem, _feedModel, $rootScope) { + function FolderBusinessLayer(_folderModel, _feedBusinessLayer, _settings, activeFeed, persistence, _feedType, itemModel, _opmlParser, _newestItem, _feedModel, $rootScope) { this._folderModel = _folderModel; this._feedBusinessLayer = _feedBusinessLayer; - this._showAll = _showAll; + this._settings = _settings; this._feedType = _feedType; this._opmlParser = _opmlParser; this._newestItem = _newestItem; @@ -1823,7 +1819,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype.isVisible = function(folderId) { var feed, _i, _len, _ref; - if (this._showAll.getShowAll() || this._feedBusinessLayer.getFeedsOfFolder(folderId).length === 0) { + if (this._settings.get('showAll') || this._feedBusinessLayer.getFeedsOfFolder(folderId).length === 0) { return true; } else { if (this.isActive(folderId) || this._feedBusinessLayer.getFolderUnreadCount(folderId) > 0) { @@ -1952,7 +1948,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return FolderBusinessLayer; })(_BusinessLayer); - return new FolderBusinessLayer(FolderModel, FeedBusinessLayer, ShowAll, ActiveFeed, Persistence, FeedType, ItemModel, OPMLParser, NewestItem, FeedModel, $rootScope); + return new FolderBusinessLayer(FolderModel, FeedBusinessLayer, Settings, ActiveFeed, Persistence, FeedType, ItemModel, OPMLParser, NewestItem, FeedModel, $rootScope); } ]); @@ -2283,53 +2279,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. */ (function() { - angular.module('News').factory('Compact', function() { - var Compact; - Compact = (function() { - function Compact() { - this._compact = false; - } - - Compact.prototype.isCompact = function() { - return this._compact; - }; - - Compact.prototype.handle = function(data) { - return this._compact = data; - }; - - return Compact; - - })(); - return new Compact(); - }); - -}).call(this); - -// Generated by CoffeeScript 1.7.1 - -/* - -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/>. - */ - -(function() { angular.module('News').factory('_ExistsError', function() { var ExistsError; ExistsError = (function() { @@ -2406,67 +2355,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. */ (function() { - var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - angular.module('News').factory('Language', function() { - var Language; - Language = (function() { - function Language() { - this._language = 'en'; - this._langs = ['ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en-ca', 'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hi', 'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne', 'nl', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'th', 'tr', 'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw']; - } - - Language.prototype.handle = function(data) { - data = data.replace('_', '-').toLowerCase(); - if (!(__indexOf.call(this._langs, data) >= 0)) { - data = data.split('-')[0]; - } - if (!(__indexOf.call(this._langs, data) >= 0)) { - data = 'en'; - } - return this._language = data; - }; - - Language.prototype.getLanguage = function() { - return this._language; - }; - - Language.prototype.getMomentFromTimestamp = function(timestamp) { - return moment.unix(timestamp).lang(this._language); - }; - - return Language; - - })(); - return new Language(); - }); - -}).call(this); - -// Generated by CoffeeScript 1.7.1 - |