This commit is contained in:
2018-04-18 17:03:35 -04:00
4 changed files with 51 additions and 0 deletions

5
.gitignore vendored
View File

@@ -41,3 +41,8 @@ testem.log
# System Files
.DS_Store
Thumbs.db
src/app/game-grid/game-grid.component.html
src/app/game-grid/game-grid.component.html
src/app/game-grid/game-grid.component.ts
src/app/game-grid/game-grid.component.html
src/app/games.service.ts

View File

@@ -26,6 +26,26 @@
</mat-toolbar>
<<<<<<< HEAD
=======
<div class="row">
<div class="col-sm-6 text-center">
<ul class="pagination">
<li *ngFor="#item of queryMaxPages; #i = index"><a href="#">1</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-sm-6 text-center">
<button *ngIf="showBack" class="btn btn-primary" (click)="backPage()">Back Page</button>
</div>
<div class="col-sm-6 text-center">
<button *ngIf="showNext" class="btn btn-primary" (click)="nextPage()">Next Page</button>
</div>
</div>
>>>>>>> abfe4ee830cfae95721bac32b34103b2538680eb
<div *ngIf="isEmptyObject(gamesData)">
<div class="flex-container" >

View File

@@ -22,10 +22,16 @@ export class GameGridComponent implements OnInit {
queryFilters = "";
querryPage = 1;
queryOrder = "Title";
<<<<<<< HEAD
length = 100;
pageSize = 10;
pageSizeOptions = [5, 10, 25, 50, 100];
=======
queryRecordMax = 9;
queryMaxPages = 0;
index = 0;
>>>>>>> abfe4ee830cfae95721bac32b34103b2538680eb
constructor(
@@ -45,6 +51,24 @@ export class GameGridComponent implements OnInit {
this.gameListSubscription = this.gamesService.getGames( this.queryFilters, this.querryPage, this.queryOrder, this.pageSize ).subscribe( data => {
this.length = data["_results"];
this.gamesData = data.games;
<<<<<<< HEAD
=======
this.queryMaxPages = Math.round( data._results / this.queryRecordMax );
console.log( this.queryMaxPages );
if( this.gamesData.length < this.queryRecordMax ){
this.showNext = false;
}else{
this.showNext = true;
}
if( this.querryPage != 1 ){
this.showBack = true;
}else{
this.showBack = false;
}
>>>>>>> abfe4ee830cfae95721bac32b34103b2538680eb
});
}

View File

@@ -38,6 +38,8 @@ export class GamesService {
getGames( queryFilters, querryPage, queryOrder, queryRecordMax ): Observable<any> {
return this.http.get( this.APIURL + "/games?filter="+ queryFilters +"&page="+ querryPage + "," + queryRecordMax +"&order="+ queryOrder +"&transform=1" )
.map(res => {
console.log( res );
return(
res
);