зеркало из https://github.com/nextcloud/news.git
viewing the first 20 items is now possible
This commit is contained in:
Родитель
eff408710b
Коммит
f7c8199380
|
@ -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,
|
||||
|
|
|
@ -43,9 +43,9 @@ class StatusFlag {
|
|||
}
|
||||
|
||||
if($showAll){
|
||||
$status |= self::UNREAD;
|
||||
} else {
|
||||
$status &= ~self::UNREAD;
|
||||
} else {
|
||||
$status |= self::UNREAD;
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
|
|
@ -27,6 +27,8 @@ angular.module('News').factory '_ItemController', ->
|
|||
|
||||
constructor: (@$scope, @itemModel, @feedLoading) ->
|
||||
|
||||
@$scope.items = @itemModel.getAll()
|
||||
|
||||
@$scope.isLoading = =>
|
||||
return @feedLoading.isLoading()
|
||||
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -24,4 +24,18 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
describe '_ItemController', ->
|
||||
|
||||
|
||||
beforeEach module 'News'
|
||||
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()
|
||||
|
|
|
@ -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}}">
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче