diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 19:30:27 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 19:30:27 +0100 |
commit | f7c819938067fb6a81822f26943a5c136643a1f7 (patch) | |
tree | aa6663df5cce7a7bbb46aad728df033706d88991 | |
parent | eff408710b708a44cf3869599985fd8246c0400b (diff) |
viewing the first 20 items is now possible
-rw-r--r-- | bl/itembl.php | 2 | ||||
-rw-r--r-- | db/statusflag.php | 4 | ||||
-rw-r--r-- | js/app/controllers/itemcontroller.coffee | 2 | ||||
-rw-r--r-- | js/public/app.js | 3 | ||||
-rw-r--r-- | js/tests/controllers/itemcontrollerSpec.coffee | 16 | ||||
-rw-r--r-- | templates/part.items.php | 2 | ||||
-rw-r--r-- | tests/bl/StatusFlagTest.php | 8 |
7 files changed, 26 insertions, 11 deletions
diff --git a/bl/itembl.php b/bl/itembl.php index 4a3f302c7..332a51774 100644 --- a/bl/itembl.php +++ b/bl/itembl.php @@ -66,7 +66,7 @@ class ItemBl extends Bl { public function findAll($id, $type, $limit, $offset, $showAll, $userId){ $status = $this->statusFlag->typeToStatus($type, $showAll); - + switch($type){ case FeedType::FEED: $items = $this->mapper->findAllFeed($id, $limit, $offset, diff --git a/db/statusflag.php b/db/statusflag.php index 96d64915b..2b96564fc 100644 --- a/db/statusflag.php +++ b/db/statusflag.php @@ -43,9 +43,9 @@ class StatusFlag { } if($showAll){ - $status |= self::UNREAD; - } else { $status &= ~self::UNREAD; + } else { + $status |= self::UNREAD; } return $status; diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee index 163d652ca..c23d84e14 100644 --- a/js/app/controllers/itemcontroller.coffee +++ b/js/app/controllers/itemcontroller.coffee @@ -27,6 +27,8 @@ angular.module('News').factory '_ItemController', -> constructor: (@$scope, @itemModel, @feedLoading) -> + @$scope.items = @itemModel.getAll() + @$scope.isLoading = => return @feedLoading.isLoading() diff --git a/js/public/app.js b/js/public/app.js index eade23a4e..766317fd5 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -209,8 +209,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. this.$scope.folders = this._folderModel.getAll(); this.$scope.feedType = this._feedType; this.$scope.isFeedActive = function(type, id) { - console.log(type + ' ' + id); - console.log(_this.isFeedActive(type, id)); return _this.isFeedActive(type, id); }; this.$scope.isShown = function(type, id) { @@ -482,6 +480,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. this.$scope = $scope; this.itemModel = itemModel; this.feedLoading = feedLoading; + this.$scope.items = this.itemModel.getAll(); this.$scope.isLoading = function() { return _this.feedLoading.isLoading(); }; diff --git a/js/tests/controllers/itemcontrollerSpec.coffee b/js/tests/controllers/itemcontrollerSpec.coffee index 32d6651a7..02682214f 100644 --- a/js/tests/controllers/itemcontrollerSpec.coffee +++ b/js/tests/controllers/itemcontrollerSpec.coffee @@ -24,4 +24,18 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. describe '_ItemController', -> - beforeEach module 'News'
\ No newline at end of file + beforeEach module 'News' + + beforeEach inject (@_ItemController, @ActiveFeed, @ShowAll, @FeedType, + @StarredCount, @FeedModel, @FolderModel, @ItemModel) => + @scope = {} + @persistence = { + getItems: -> + } + @controller = new @_ItemController(@scope, @ItemModel) + + it 'should make items availabe', => + @ItemModel.getAll = jasmine.createSpy('ItemModel') + new @_ItemController(@scope, @ItemModel) + + expect(@ItemModel.getAll).toHaveBeenCalled() diff --git a/templates/part.items.php b/templates/part.items.php index 9bc3206ca..6ca0a1280 100644 --- a/templates/part.items.php +++ b/templates/part.items.php @@ -1,6 +1,6 @@ <ul> <li class="feed_item" - ng-repeat="item in getItems(activeFeed.type, activeFeed.id) | orderBy:'date':true " + ng-repeat="item in items | orderBy:'date':true " ng-class="{read: item.isRead}" data-id="{{item.id}}" data-feed="{{item.feedId}}"> diff --git a/tests/bl/StatusFlagTest.php b/tests/bl/StatusFlagTest.php index 9e9be9fca..ab8a612ff 100644 --- a/tests/bl/StatusFlagTest.php +++ b/tests/bl/StatusFlagTest.php @@ -42,7 +42,7 @@ class StatusFlagTest extends TestUtility { public function testTypeToStatusUnreadStarred(){ $expected = StatusFlag::UNREAD | StatusFlag::STARRED; - $status = $this->statusFlag->typeToStatus(FeedType::STARRED, true); + $status = $this->statusFlag->typeToStatus(FeedType::STARRED, false); $this->assertEquals($expected, $status); } @@ -50,7 +50,7 @@ class StatusFlagTest extends TestUtility { public function testTypeToStatusUnread(){ $expected = StatusFlag::UNREAD; - $status = $this->statusFlag->typeToStatus(FeedType::FEED, true); + $status = $this->statusFlag->typeToStatus(FeedType::FEED, false); $this->assertEquals($expected, $status); } @@ -58,7 +58,7 @@ class StatusFlagTest extends TestUtility { public function testTypeToStatusReadStarred(){ $expected = (~StatusFlag::UNREAD) & StatusFlag::STARRED; - $status = $this->statusFlag->typeToStatus(FeedType::STARRED, false); + $status = $this->statusFlag->typeToStatus(FeedType::STARRED, true); $this->assertEquals($expected, $status); } @@ -66,7 +66,7 @@ class StatusFlagTest extends TestUtility { public function testTypeToStatusRead(){ $expected = (~StatusFlag::UNREAD) & 0; - $status = $this->statusFlag->typeToStatus(FeedType::FEED, false); + $status = $this->statusFlag->typeToStatus(FeedType::FEED, true); $this->assertEquals($expected, $status); } |