Commit 5ada347d authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix(news): clean code and remove unecesary api call for 'a-la-une' tag

parent 99a1c6c0
Pipeline #20291 passed with stages
in 4 minutes
......@@ -30,7 +30,7 @@
<div fxLayout="column" class="informations">
<div>{{ post.author }}</div>
<div>
{{ post.updated_at | date: 'dd MMM y' }}
{{ post.updated_at | date: 'd MMM y' }}
</div>
</div>
</div>
......
......@@ -44,7 +44,6 @@
.informations {
@include cn-regular-16;
div:nth-child(2n) {
text-transform: uppercase;
color: $grey-3;
}
}
......
......@@ -34,7 +34,6 @@ $margin-post: 20px;
.informations {
@include cn-regular-16;
div:nth-child(2n) {
text-transform: uppercase;
color: $grey-3;
}
}
......@@ -201,7 +200,7 @@ $margin-post: 20px;
.gh-canvas .article-image {
grid-column: wide-start/wide-end;
width: 100%;
margin: 6vmin 0 0;
margin: 4vmin 0 0;
img {
display: block;
margin-left: auto;
......
......@@ -21,9 +21,6 @@ export class PostListComponent implements OnInit {
public selectedPublicTagsSlug = [];
public filters: Tag[];
public allPosts: Post[] = [];
public leftColumnPosts: Post[] = [];
public rightColumnPosts: Post[] = [];
public bigNews: Post;
public pagination: Pagination;
public isLoading = false;
public isPublishMode = false;
......@@ -46,11 +43,6 @@ export class PostListComponent implements OnInit {
ngOnInit(): void {
this.isLoading = true;
// Init APP news list
this.postService.getPosts(1, [TagEnum.aLaUne]).subscribe((news) => {
if (news.posts[0]) {
this.bigNews = this.addAuthorToPost(news.posts[0]);
}
});
this.route.queryParams.subscribe((queryParams) => {
this.isPublishMode = false;
// If main tag is in route, set it
......@@ -70,7 +62,8 @@ export class PostListComponent implements OnInit {
// Init default news list
this.postService.getPosts(1).subscribe((news) => {
this.setNews(news);
this.allPosts.unshift(this.bigNews);
const headLineTag = this.allPosts.find((post: Post) => post.tags.some((tag) => tag.slug === TagEnum.aLaUne));
this.allPosts.unshift(headLineTag);
});
}
});
......@@ -113,14 +106,10 @@ export class PostListComponent implements OnInit {
}
public resetPosts(): void {
this.leftColumnPosts = [];
this.rightColumnPosts = [];
this.allPosts = [];
}
public publishNews(): void {}
//Transform excerpt post to have a custom author.
// Transform excerpt post to have a custom author.
private addAuthorToPost(post: Post): Post {
post.author = post.excerpt;
post.excerpt = post.html.replace(/<[^>]*>/g, '');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment