Skip to content

Commit 0ffa4b1

Browse files
author
JLRR2019
committed
News, news template y showvideogame (sin la parte de mani) y sin paginacion completa
1 parent 4236b18 commit 0ffa4b1

File tree

4 files changed

+64
-58
lines changed

4 files changed

+64
-58
lines changed

frontend/src/app/components/news/news.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1 class="fw-bolder fs-5 mb-4">Noticias destacadas</h1>
1313
</div>
1414
</div>
1515
<div class="col-lg-6 col-xl-7">
16-
<div class="bg-featured-blog" style="background-image: url('Photos/lostark.jpg')">
16+
<div class="bg-featured-blog" style="background-image: url('./assets/images/lostark.jpg')">
1717
</div>
1818
</div>
1919
</div>

frontend/src/app/components/news/newsTemplate.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@ import { NewsService } from 'src/app/services/news.service';
1313
//const id = activatedRoute.snapshot.params['id'];
1414
export class NewsTemplateComponent{
1515

16-
@Input() id!: number; //para que se vea en el padre, poner input, fin
1716
@Input() news!: News;
1817

1918
constructor(public newsService: NewsService, activatedRoute: ActivatedRoute, private router: Router){
2019

2120
}
2221

23-
ngOnInit(){
22+
23+
24+
25+
26+
/*ngOnInit(){ ngOnInit son las cosas que se van a cargar despues del constructor.
2427
this.newsService.getNew(this.id).subscribe(
2528
(news) => this.news = news as News,
2629
(error: any) => console.error(error)
2730
28-
);
31+
);*/
2932

30-
}
3133

3234

3335

Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,68 @@
1-
<div *ngIf="news">
2-
3-
<!-- Header-->
4-
<header class="bg-dark py-5" style="background-color: #454546 !important;">
5-
<div class="container px-5">
6-
<div class="row gx-5 align-items-center justify-content-center">
7-
<div class="col-xl-5 col-xxl-6 d-none d-xl-block text-center"><img class="img-fluid rounded-3 my-5"
8-
src="/news/{{news?.id}}/image" alt="..." /></div>
9-
<div class="col-lg-8 col-xl-7 col-xxl-6">
10-
<div class="my-5 text-center text-xl-start">
11-
<h1 class="display-5 fw-bolder text-white mb-2" style="font-size: 40px;">{{news?.title}}</h1>
12-
<p class="lead fw-normal text-white-50 mb-4" style="color: aliceblue !important;">{{news?.argument}}</p>
13-
</div>
1+
<!-- Header-->
2+
<header class="bg-dark py-5" style="background-color: #454546 !important;">
3+
<div class="container px-5">
4+
<div class="row gx-5 align-items-center justify-content-center">
5+
<div class="col-xl-5 col-xxl-6 d-none d-xl-block text-center"><img class="img-fluid rounded-3 my-5"
6+
[src]="newsImage()" alt="..." /></div>
7+
<div class="col-lg-8 col-xl-7 col-xxl-6">
8+
<div class="my-5 text-center text-xl-start">
9+
<h1 class="display-5 fw-bolder text-white mb-2" style="font-size: 40px;">{{news?.title}}</h1>
10+
<p class="lead fw-normal text-white-50 mb-4" style="color: aliceblue !important;">{{news?.argument}}</p>
1411
</div>
1512
</div>
1613
</div>
14+
</div>
1715

1816

1917

20-
</header>
18+
</header>
2119

22-
<div *ngIf="isAdmin()">
23-
<section class="pt-0 MoreInfo">
24-
<div class="container-fluid my-5">
25-
<div class="row justify-content-center" style=" background-color: rgb(27, 31, 31); margin-bottom: 2%;">
26-
<div class="col-5 text-center">
27-
<p class="lead fw-normal text-white-50 mb-4"
28-
style="color: aliceblue !important; font-size: 2em !important; margin-top: 5%;"> Admin Actions :
29-
<a class="btn btn-primary btn-lg px-4 me-sm-3" [routerLink]="['/deleteNew/{{news?.id}}']"
30-
style="margin-top: auto;">Eliminar</a>
31-
<a class="btn btn-outline-light btn-lg px-4" [routerLink]="['/editNew/{{news?.id}}']"
32-
style="margin-top: auto;">Editar</a>
33-
</p>
34-
</div>
35-
</div>
20+
21+
<section class="pt-0 MoreInfo" *ngIf="isAdmin()">
22+
<div class="container-fluid my-5">
23+
<div class="row justify-content-center" style=" background-color: rgb(27, 31, 31); margin-bottom: 2%;">
24+
<div class="col-5 text-center">
25+
<p class="lead fw-normal text-white-50 mb-4"
26+
style="color: aliceblue !important; font-size: 2em !important; margin-top: 5%;"> Admin Actions :
27+
<a class="btn btn-primary btn-lg px-4 me-sm-3" [routerLink]="['/deleteNew/{{news?.id}}']"
28+
style="margin-top: auto;">Eliminar</a>
29+
<a class="btn btn-outline-light btn-lg px-4" [routerLink]="['/editNew/{{news?.id}}']"
30+
style="margin-top: auto;">Editar</a>
31+
</p>
3632
</div>
37-
</section>
33+
</div>
3834
</div>
35+
</section>
3936

4037

41-
<!-- MoreInfo-->
42-
<section class="pt-0 MoreInfo" style="margin-left: 10%; margin-right: 10%; background-color: #FFFFFF !important;">
43-
<div class="container px-5 my-5">
44-
<div class="row gx-5 justify-content-center">
45-
<div class="col-md-12">
46-
<h1 style="padding-bottom: 10px;">Leer más:</h1>
47-
<p class="">
48-
{{news?.description}}
49-
</p>
50-
</div>
5138

39+
<!-- MoreInfo-->
40+
<section class="pt-0 MoreInfo" style="margin-left: 10%; margin-right: 10%; background-color: #FFFFFF !important;">
41+
<div class="container px-5 my-5">
42+
<div class="row gx-5 justify-content-center">
43+
<div class="col-md-12">
44+
<h1 style="padding-bottom: 10px;">Leer más:</h1>
45+
<p class="">
46+
{{news?.description}}
47+
</p>
5248
</div>
5349

5450
</div>
55-
</section>
56-
57-
<section class="pt-0 MoreInfo" style="margin-left: 10%; margin-right: 10%; background-color: inherit !important;">
58-
<div class="container px-5 my-5">
59-
<div class="row gx-5 justify-content-center">
60-
<!--{{>videogameTemplate}}-->
61-
</div>
62-
</div>
63-
</section>
6451

52+
</div>
53+
</section>
6554

55+
<section class="pt-0 MoreInfo" style="margin-left: 10%; margin-right: 10%; background-color: inherit !important;">
56+
<div class="container px-5 my-5">
57+
<div class="row gx-5 justify-content-center">
58+
<!--{{>videogameTemplate}}-->
59+
</div>
60+
</div>
61+
</section>
6662

67-
<!-- Bootstrap core JS-->
68-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
69-
<!-- Core theme JS-->
70-
<script src="js/scripts.js"></script>
7163

7264

73-
</div>
65+
<!-- Bootstrap core JS-->
66+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
67+
<!-- Core theme JS-->
68+
<script src="js/scripts.js"></script>

frontend/src/app/components/news/showNews.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,13 @@ export class ShowNewsComponent{
2929
return this.loginService.isAdmin();
3030
}
3131

32+
newsImage(){
33+
if(this.news){ //We have to put this always. If exist any new...
34+
return this.news.image? '/api/news/' + this.news.id + '/image' : '/assets/images/not_foung.png';
35+
} else {
36+
return undefined;
37+
}
38+
}
39+
40+
3241
}

0 commit comments

Comments
 (0)