Skip to content

Commit 9fc47cd

Browse files
committed
Send emails and some fixes
Send emails in post and add security when user access to category or post which no exists
1 parent f6f9afc commit 9fc47cd

File tree

7 files changed

+145
-144
lines changed

7 files changed

+145
-144
lines changed

angular/wallypop/.idea/workspace.xml

Lines changed: 17 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular/wallypop/src/app/components/articles/commercial.component.html

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
<!-- ====== Page content ======-->
33
<section class="section">
44
<search></search>
5-
<!--{{#ERROR}}
6-
<br>
7-
<div class="container">
8-
<div class="alert alert-danger" role="alert">
9-
<center>El artículo que buscas no existe o ya no está disponible</center>
10-
</div>
11-
</div>
12-
{{/ERROR}} -->
135
<hr>
146
<div class="container-fluid">
157
<div class="row">
@@ -19,26 +11,14 @@
1911
data-drop-cont=".menu-commercial">
2012
FILTROS <i aria-hidden="true" class="fa fa-sort pull-right"></i>
2113
</button>
22-
<form action="/search/commercial" class="full-width menu-commercial" method="GET">
23-
<!--<h4 class="text-light">CATEGORÍA</h4>
24-
<div class="form-group">
25-
<select class="form-control" name="id_category">
26-
<option disabled selected>Selecciona una categoría</option>
27-
<option *ngFor="let category of categories" name="CATEGORY" value="{{category.id_CATEGORY}}">{{category.title}}</option>
28-
</select>
29-
</div>
30-
<p class="text-center">
31-
<button class="btn btn-success btn-block">APLICAR</button>
32-
</p> -->
33-
<p>
34-
<small>Anuncios segunda mano. Las mejores ofertas en de segunda mano y de ocasión solo
35-
en Wallypop</small>
36-
</p>
37-
<p class="text-center">
38-
<a class="btn btn-info btn-block" href="/commercial" onclick="" type="reset">BORRAR
39-
FILTROS</a>
40-
</p>
41-
</form>
14+
<p>
15+
<small>Anuncios segunda mano. Las mejores ofertas en de segunda mano y de ocasión solo
16+
en Wallypop</small>
17+
</p>
18+
<p class="text-center">
19+
<a class="btn btn-info btn-block" href="/commercial" onclick="" type="reset">BORRAR
20+
FILTROS</a>
21+
</p>
4222
</div>
4323
</div>
4424
<div class="col-xs-12 col-sm-9 col-md-10">
@@ -47,31 +27,26 @@
4727
<li *ngFor="let category of categories"><a href="/commercial/{{category.id_CATEGORY}}">{{category.title}}</a></li>
4828
</ol>
4929
</div>
50-
<!-- <div class="full-widht">
51-
<i class="fa fa-th-large btn btn-default hidden-xs btn-change-post"></i>
52-
<i class="fa fa-refresh btn btn-default"></i>
53-
<i class="fa fa-angle-right btn btn-default"></i>
54-
</div> -->
5530
<!-- Article -->
5631
<div class="full-width container-post">
57-
<div class="full-width post" *ngFor="let article of articles">
58-
<ng-template [ngIf]="!article.sold">
59-
<figure class="full-width post-img">
60-
<img alt="" class="img-responsive" src="/api/articles/{{article.id_ARTICLE}}/image">
61-
</figure>
62-
<div class="full-width post-info">
63-
<a class="full-width post-info-title" href="/post/{{article.id_ARTICLE}}">{{article.title}}</a>
64-
<p class="full-width post-info-price">{{article.price}}€</p>
65-
<span class="post-info-zone">{{article.city}}</span>
66-
<span class="post-info-date">{{article.date}}</span>
67-
<a *ngIf="this.loginService.isLogged()" href="/addFavorite/{{article.id_ARTICLE}}"><i class="fa fa-heart-o post-info-like"></i></a>
68-
</div>
69-
</ng-template>
32+
<div *ngFor="let article of articles">
33+
<div class="full-width post" *ngIf="!article.sold">
34+
<figure class="full-width post-img">
35+
<img alt="" class="img-responsive" src="/api/articles/{{article.id_ARTICLE}}/image">
36+
</figure>
37+
<div class="full-width post-info">
38+
<a class="full-width post-info-title" href="/post/{{article.id_ARTICLE}}">{{article.title}}</a>
39+
<p class="full-width post-info-price">{{article.price}}€</p>
40+
<span class="post-info-zone">{{article.city}}</span>
41+
<span class="post-info-date">{{article.date}}</span>
42+
<a *ngIf="this.loginService.isLogged()" href="/addFavorite/{{article.id_ARTICLE}}"><i class="fa fa-heart-o post-info-like"></i></a>
43+
</div>
44+
</div>
7045
</div>
7146
</div>
7247

7348
<!-- End Article -->
74-
<div class="clearfix"></div>
49+
<!-- <div class="clearfix"></div>
7550
<nav class="text-center">
7651
<ul class="pagination">
7752
<li>
@@ -90,7 +65,7 @@
9065
</a>
9166
</li>
9267
</ul>
93-
</nav>
68+
</nav> -->
9469
</div>
9570
</div>
9671
</div>

angular/wallypop/src/app/components/articles/commercial.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import {ArticleService} from '../../services/article.service';
44
import {Article} from '../../models/article.model';
55
import {Category} from '../../models/category.model';
66
import {CategoryService} from '../../services/category.service';
7-
import {User} from '../../models/user.model';
8-
import {ActivatedRoute} from '@angular/router';
7+
import {ActivatedRoute, Router} from '@angular/router';
98

109
@Component({
1110
selector: 'commercial',
@@ -19,9 +18,8 @@ export class CommercialComponent implements OnInit {
1918
filtered: boolean;
2019
query: string;
2120
city: string;
22-
noArticles = false;
2321
// tslint:disable-next-line:max-line-length
24-
constructor(private articleService: ArticleService, private categoryService: CategoryService, private loginService: LoginService, private routing: ActivatedRoute) {
22+
constructor(private articleService: ArticleService, private categoryService: CategoryService, public loginService: LoginService, private routing: ActivatedRoute, private router: Router) {
2523
this.idCategory = -1;
2624
this.filtered = false;
2725
}
@@ -63,7 +61,11 @@ export class CommercialComponent implements OnInit {
6361
getArticlesFromCategory(id: number | string): void {
6462
this.categoryService.getCategory(id).subscribe(
6563
articles => this.articles = articles,
66-
error => console.log(error)
64+
error => {
65+
console.log(error);
66+
alert('No existe esta categoría o no hay artículos disponibles');
67+
this.router.navigate(['commercial']);
68+
}
6769
);
6870
}
6971

0 commit comments

Comments
 (0)