Skip to content

Commit

Permalink
Some errors successfully solved.
Browse files Browse the repository at this point in the history
  • Loading branch information
cvazquezlos committed Apr 16, 2017
1 parent 5bb3998 commit 47de2d8
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ public ResponseEntity<Page<Genre>> getAllGenres(HttpSession session, @RequestPar
session.setMaxInactiveInterval(-1);
if(page==null) page = 0;
Page<Genre> genres = genreService.findAll(page);
if (genres.getNumberOfElements() > 0) {
return new ResponseEntity<>(genres, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(genres, HttpStatus.OK);
}

@JsonView(GenreDetail.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ public ResponseEntity<Page<ResourceCopy>> getResourceCopies(HttpSession session,
session.setMaxInactiveInterval(-1);
if(page==null) page=0;
Page<ResourceCopy> resourceCopies = resourceCopyService.findAll(page);
if (resourceCopies.getNumberOfElements() > 0) {
return new ResponseEntity<>(resourceCopies, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(resourceCopies, HttpStatus.OK);
}

@JsonView(ResourceCopyDetail.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ public ResponseEntity<Page<Resource>> getAllResource(HttpSession session,
session.setMaxInactiveInterval(-1);
if(page==null) page=0;
Page<Resource> resources = resourceService.findByGenreAndNameAndTypeAllIgnoreCase(genre, type, name, page);
if (resources.getNumberOfElements() >0) {
return new ResponseEntity<>(resources, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<>(resources, HttpStatus.OK);
}

@JsonView(ResourceDetail.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ public ResponseEntity<Page<ResourceType>> getResourceTypes(HttpSession session,
session.setMaxInactiveInterval(-1);
if(page==null) page=0;
Page<ResourceType> resourceTypes = resourceTypeService.findAll(page);
if (resourceTypes.getNumberOfElements() >0) {
return new ResponseEntity<>(resourceTypes, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(resourceTypes, HttpStatus.OK);
}

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ public ResponseEntity<Page<User>> getUsers(HttpSession session, @RequestParam (r
session.setMaxInactiveInterval(-1);
if(page==null) page=0;
Page<User> users = userService.findAll(page);
if (users.getNumberOfElements() > 0) {
return new ResponseEntity<>(users, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(users, HttpStatus.OK);
}

@JsonView(UserDetail.class)
Expand Down
Binary file modified backend/target/appSpring-0.0.1.jar
Binary file not shown.
Binary file modified backend/target/appSpring-0.0.1.jar.original
Binary file not shown.
16 changes: 12 additions & 4 deletions frontend/src/app/component/public/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<div class="row item">
<div class="col-sm-12 col-md-4 col-lg-3">
<div class="coverItem">
<img [src]="sanitizer.bypassSecurityTrustUrl(book.image)" class="img-responsive" />
<div *ngIf="book.image != undefined">
<img [src]="sanitizer.bypassSecurityTrustUrl(book.image)" class="img-responsive" />
</div>
<div>
<div *ngIf="isLogged">
<div>
Expand Down Expand Up @@ -53,7 +55,9 @@ <h5 class="authorName">por {{book.author}}</h5>
</div>
</div>
</ng-template>
<button [class.showBtnMoreBook]="moreBooksActive" (click)="addBooks(true)" type="button" class="btn btn-lg btn-block btn-view-more">Ver más libros</button>
<div *ngIf="moreBooksActive">
<button (click)="addBooks(true)" type="button" class="btn btn-lg btn-block btn-view-more">Ver más libros</button>
</div>
</div>
</template>
</ngb-tab>
Expand All @@ -64,7 +68,9 @@ <h5 class="authorName">por {{book.author}}</h5>
<div class="row item">
<div class="col-sm-12 col-md-4 col-lg-3">
<div class="coverItem">
<img [src]="sanitizer.bypassSecurityTrustUrl(magazine.image)" class="img-responsive" />
<div *ngIf="magazine.image != undefined">
<img [src]="sanitizer.bypassSecurityTrustUrl(magazine.image)" class="img-responsive" />
</div>
<div>
<div *ngIf="isLogged">
<div>
Expand Down Expand Up @@ -96,7 +102,9 @@ <h5 class="authorName">por {{magazine.author}}</h5>
</div>
</div>
</ng-template>
<button [class.showBtnMoreMagaz]="moreMagazActive" (click)="addMagazines(true)" type="button" class="btn btn-lg btn-block btn-view-more">Ver más revistas</button>
<div *ngIf="moreMagazActive">
<button (click)="addMagazines(true)" type="button" class="btn btn-lg btn-block btn-view-more">Ver más revistas</button>
</div>
</div>
</template>
</ngb-tab>
Expand Down
40 changes: 9 additions & 31 deletions frontend/src/app/component/public/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@ import {SessionService} from '../../../service/session.service';
import {UserService} from '../../../service/user.service';

@Component({
templateUrl: 'home.component.html',
styles: [`
.showBtnMoreBook {
display: block
}
.showBtnMoreMagaz {
display: block
}`]
templateUrl: 'home.component.html'
})

export class HomeComponent implements OnInit {
Expand Down Expand Up @@ -66,47 +58,33 @@ export class HomeComponent implements OnInit {
addBooks(userReq: boolean) {
this.resourceService.getAllResources('Libro', this.booksPage).subscribe(
books => {
if (userReq) {
if (books[1] === undefined) {
this.moreBooksActive = false;
} else if (userReq) {
this.booksPage++;
this.books = this.books.concat(books);
this.downloadImages(this.books);
this.addBooks(false);
}
},
error => {
if (error.statusCode == STATUS_NO_CONTENT) {
console.log(error + " - STATUS CODE: " + error.statusCode);
}
else {
if (userReq)
console.error("ERROR: " + error);
}
this.moreBooksActive = false;
}
error => console.log('Fail trying to get BREMS books.')
);

}

addMagazines(userReq: boolean) {
this.resourceService.getAllResources('Revista', this.magazinesPage).subscribe(
magazines => {
if (userReq) {
if (magazines[1] == null) {
this.moreMagazActive = false;
} else if (userReq) {
this.magazinesPage++;
this.magazines = this.magazines.concat(magazines);
this.downloadImages(this.magazines);
this.addMagazines(false);
}
},
error => {
if (error.statusCode == STATUS_NO_CONTENT) {
console.log(error + " - STATUS CODE: " + error.statusCode);
}
else {
if (userReq)
console.error("ERROR: " + error);
}
this.moreMagazActive = false;
}
error => console.log('Fail trying to get BREMS magazines.')
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div [@dialog]="visible" [class.hide]="!visible" class="modalAviso modal-dialog">
<ng-content></ng-content>


<div class="modal-content">
<div class="modal-header" align="center">
<img id="img_logo" src="./assets/img/logo.png">
Expand All @@ -10,31 +8,29 @@
</button>
</div>
<div id="div-forms">
<!-- Login form -->
<div class="modal-body">
<div id="div-login-msg">
<div id="icon-login-msg" class="glyphicon glyphicon-chevron-right"></div>
<span id="text-login-msg">Escribe tu usuario</span>
</div>
<input id="username" #username class="form-control" name="username" type="text" placeholder="Usuario" required>
<input id="username" #username class="form-control" name="username" type="text"
placeholder="Usuario" required>

<div id="div-login-msg">
<div id="icon-login-msg" class="glyphicon glyphicon-chevron-right"></div>
<span id="text-login-msg">Escribe tu contrase&ntilde;a</span>
<span id="text-login-msg">Escribe tu contraseña</span>
</div>
<input id="password" #password class="form-control" name="password" type="password"
placeholder="Contrase&ntilde;a" required>
<div class="checkbox">
<!--<label> <input type="checkbox"> Recordar</label>-->
</div>
placeholder="Contraseña" required>
</div>
<div class="modal-footer">
<div>
<button class="btn btn-primary btn-lg btn-block" (click)="logIn(username.value, password.value)">Iniciar sesi&oacute;n</button>
<button class="btn btn-primary btn-lg btn-block" (click)="logIn(username.value, password.value)">
Iniciar sesión</button>
</div>
<div>
<a [routerLink]="['']">
<button id="login_lost_btn" type="button" class="btn btn-link">Olvid&eacute; mi contraseña</button>
<button id="login_lost_btn" type="button" class="btn btn-link">Olvidé mi contraseña</button>
</a>
<a [routerLink]="['/register']">
<button id="login_register_btn" type="button" class="btn btn-link">Registrarse</button>
Expand All @@ -43,7 +39,6 @@
</div>
</div>
</div>

</div>
<div *ngIf="visible" class="overlay" (click)="close()"></div>

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div [@dialog]="visible" [class.hide]="!visible" class="modalAviso modalProfileEdit modal-dialog">
<ng-content></ng-content>

<div class="modal-content">
<div class="modal-header" align="center">
<h3>Información Básica</h3>
Expand All @@ -9,9 +8,7 @@ <h3>Información Básica</h3>
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
</div>

<div id="div-forms">
<!-- edit form -->
<div class="modal-body modal-body-profile">
<div class="form-group">

Expand Down Expand Up @@ -72,10 +69,8 @@ <h3>Información Básica</h3>
</button>
</div>
</div>

</div>
</div>

</div>
<div *ngIf="visible" class="overlay" (click)="close()"></div>

12 changes: 9 additions & 3 deletions frontend/src/app/component/public/user/profile.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<template ngbTabContent>
<div class="row userProfile">
<div class="col-lg-2 avatar">
<img [src]="sanitizer.bypassSecurityTrustUrl(userImage)" class="img-responsive avatar">
<div *ngIf="userImage != undefined">
<img [src]="sanitizer.bypassSecurityTrustUrl(userImage)" class="img-responsive avatar">
</div>
</div>
<div class="col-lg-8">
<h4>
Expand Down Expand Up @@ -74,7 +76,9 @@ <h4>
<div class="row item">
<div class="col-sm-6 col-md-4 col-lg-2">
<div class="coverItem">
<img [src]="sanitizer.bypassSecurityTrustUrl(action.copy.resource.image)" class="img-responsive" />
<div *ngIf="action.copy.resource.image != undefined">
<img [src]="sanitizer.bypassSecurityTrustUrl(action.copy.resource.image)" class="img-responsive" />
</div>
<br>
<a [routerLink]="['/resource',action.copy.resource.id]"> <span class="glyphicon glyphicon-info-sign"></span>ver libro
</a>
Expand Down Expand Up @@ -110,7 +114,9 @@ <h4>
<div class="row item">
<div class="col-sm-6 col-md-4 col-lg-2">
<div class="coverItem">
<img [src]="sanitizer.bypassSecurityTrustUrl(action.copy.resource.image)" class="img-responsive" />
<div *ngIf="action.copy.resource.image != undefined">
<img [src]="sanitizer.bypassSecurityTrustUrl(action.copy.resource.image)" class="img-responsive" />
</div>
<br>
<a [routerLink]="['/resource',action.copy.resource.id]"> <span class="glyphicon glyphicon-info-sign"></span>ver libro
</a>
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/app/component/public/user/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import {ModalProfileEdit} from "./modal.profile.component/modal-profile-edit";
import {IMG_URL} from "../../../util";
import {ModalBiographyEdit} from "./modal.biography.component/modal-biography-edit";

const url_avatar = IMG_URL + "avatars/";

@Component({
templateUrl: 'profile.component.html'
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/model/resource.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export interface Resource {
title: string;
author: string;
editorial: string;
image: any;
image?: any;
avaiblereserve: boolean;
description: string;
hasPhoto: boolean;
Expand Down

0 comments on commit 47de2d8

Please sign in to comment.