From 015fbb80fcbdf942dc42efe9f1edb53a71a1b9f8 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 19 Dec 2013 17:47:10 +0100 Subject: add compact view, fix #267, merry christmas ;D --- js/app/controllers/itemcontroller.coffee | 9 +++++++++ js/app/services/persistence.coffee | 7 ++++--- js/public/app.js | 16 +++++++++++++--- js/tests/controllers/itemcontrollerSpec.coffee | 13 ++++++++++++- 4 files changed, 38 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee index ee2fa7e82..1b5d4a350 100644 --- a/js/app/controllers/itemcontroller.coffee +++ b/js/app/controllers/itemcontroller.coffee @@ -87,6 +87,15 @@ Language, AutoPageLoading, Compact) -> @_$scope.isCompactView = => return @_compact.isCompact() + @_$scope.is = + active: 0 + + @_$scope.toggleOpen = (id) => + if id == @_$scope.is.active + @_$scope.is.active = 0 + else + @_$scope.is.active = id + return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading, AutoPageLoading, FeedBusinessLayer, Language, diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index 05558b3e1..176589e9c 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -39,9 +39,6 @@ $rootScope, $q) -> @deferred = $q.defer() - # items can only be loaded after the active feed is known - @getActiveFeed => - @getItems(@_activeFeed.getType(), @_activeFeed.getId()) @getAllFolders() @@ -53,6 +50,10 @@ $rootScope, $q) -> @userSettingsLanguage() @userSettingsIsCompact() + # items can only be loaded after the active feed is known + @getActiveFeed => + @getItems(@_activeFeed.getType(), @_activeFeed.getId()) + @deferred.promise ### diff --git a/js/public/app.js b/js/public/app.js index f49f2546c..caaf5dc52 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -867,6 +867,16 @@ License along with this library. If not, see . this._$scope.isCompactView = function() { return _this._compact.isCompact(); }; + this._$scope.is = { + active: 0 + }; + this._$scope.toggleOpen = function(id) { + if (id === _this._$scope.is.active) { + return _this._$scope.is.active = 0; + } else { + return _this._$scope.is.active = id; + } + }; } return ItemController; @@ -2722,9 +2732,6 @@ License along with this library. If not, see . var successCallback, _this = this; this.deferred = $q.defer(); - this.getActiveFeed(function() { - return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId()); - }); this.getAllFolders(); successCallback = function() { return _this.deferred.resolve(); @@ -2733,6 +2740,9 @@ License along with this library. If not, see . this.userSettingsRead(); this.userSettingsLanguage(); this.userSettingsIsCompact(); + this.getActiveFeed(function() { + return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId()); + }); return this.deferred.promise; }; diff --git a/js/tests/controllers/itemcontrollerSpec.coffee b/js/tests/controllers/itemcontrollerSpec.coffee index 955f9fe16..03b6bbc2e 100644 --- a/js/tests/controllers/itemcontrollerSpec.coffee +++ b/js/tests/controllers/itemcontrollerSpec.coffee @@ -189,4 +189,15 @@ describe 'ItemController', -> it 'should bind the compact object', => expect(@scope.isCompactView()).toBe(false) @Compact.handle(true) - expect(@scope.isCompactView()).toBe(true) \ No newline at end of file + expect(@scope.isCompactView()).toBe(true) + + + it 'should toggle active ones and close old ones', => + expect(@scope.is.active).toBe(0) + + @scope.toggleOpen(3) + expect(@scope.is.active).toBe(3) + + @scope.toggleOpen(3) + expect(@scope.is.active).toBe(0) + -- cgit v1.2.3 f893ea725dd583a13fc9'>commitdiffstats
blob: dbb11e9bc8e56ca12a5a1fc6804a54979ced6d99 (plain)
1
2
3
# Miscellaneous material

This section contains material that will be moved to new locations as we see fit. We keep it here to make it accessible while we make these changes.