Skip to content

Commit

Permalink
Merge pull request #151 from raffacabofrio/master
Browse files Browse the repository at this point in the history
Estória 19. Add campo sinópse.
  • Loading branch information
wantero authored Dec 7, 2018
2 parents 95592dd + 632b443 commit 15c165d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/components/book/details/details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>
<p><b>Autor:</b><br/>{{bookInfo.author}}</p>
<p><b>Categoria:</b><br/>{{bookInfo.category?.name}}</p>
<p><b>Doador paga o frete?</b><br/>{{freightName}}</p>
<p *ngIf="!!bookInfo.synopsis"><b>Sinópse:</b><br/><textarea readonly style="height:300px;width:90%;border:0px">{{bookInfo.synopsis}}</textarea></p>

<div class="form-group col-md-8">
<div class="modal-footer">
Expand Down
11 changes: 11 additions & 0 deletions src/app/components/book/form/form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>

</div>

<div class="form-group col-md-8">
<label class="col-form-label" for="synopsis">Sinópse</label>
<textarea formControlName="synopsis" type="text" class="form-control" maxlength="2000" style="height: 300px;"></textarea>

<div *ngIf="formGroup.controls['synopsis'].touched && !formGroup.controls['synopsis'].valid">
<small class="form-text text-danger" *ngIf="formGroup.controls['synopsis'].hasError('maxlength') ">
A sinópse deve conter no máximo 2000 caracteres.
</small>
</div>
</div>

<div class="form-group col-md-8" *ngIf="userProfile === 'Administrator' && itsEditMode">
<label class="col-form-label" for="approved">Situação do livro</label>
<div class="btn-group btn-block btn-group-toggle" data-toggle="buttons">
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/book/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class FormComponent implements OnInit {
approved: false,
imageUrl: '',
imageSlug: '',
synopsis: ['', [Validators.maxLength(2000)]],
});
}

Expand Down Expand Up @@ -112,6 +113,7 @@ export class FormComponent implements OnInit {
approved: x.approved,
imageUrl: x.imageUrl,
imageSlug: x.imageSlug,
synopsis: !!x.synopsis ? x.synopsis : ''
};
this.formGroup.setValue(bookForUpdate);
}
Expand Down
1 change: 1 addition & 0 deletions src/app/core/models/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export class Book {
freightOption: string;
category: Category;
creationDate: Date;
synopsis: string;
}

0 comments on commit 15c165d

Please sign in to comment.