Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client
1 result
Show changes
Commits on Source (16)
...@@ -102,7 +102,6 @@ deploy_rec: ...@@ -102,7 +102,6 @@ deploy_rec:
environment: environment:
name: rec name: rec
url: https://resin-rec.grandlyon.com url: https://resin-rec.grandlyon.com
# code_analysis: # code_analysis:
# image: skilldlabs/sonar-scanner:3.4.0 # image: skilldlabs/sonar-scanner:3.4.0
# services: # services:
...@@ -124,15 +123,15 @@ deploy_rec: ...@@ -124,15 +123,15 @@ deploy_rec:
# -Dsonar.projectKey=${SONAR_PROJECT_KEY} # -Dsonar.projectKey=${SONAR_PROJECT_KEY}
# -Dsonar.login=${SONAR_TOKEN} # -Dsonar.login=${SONAR_TOKEN}
mr: # mr:
variables: # variables:
DOCKER_TLS_CERTDIR: '' # DOCKER_TLS_CERTDIR: ''
DOCKER_HOST: tcp://docker:2375/ # DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2 # DOCKER_DRIVER: overlay2
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09 # image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09
stage: build # stage: build
only: # only:
- merge_requests # - merge_requests
script: # script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY # - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE:dev" --build-arg conf=dev . # - docker build --pull -t "$CI_REGISTRY_IMAGE:dev" --build-arg conf=dev .
...@@ -2,6 +2,23 @@ ...@@ -2,6 +2,23 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [1.16.1](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v1.16.0...v1.16.1) (2022-03-29)
### Features
* **cicd:** temp remove of mr jobs ([5c9a74a](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/5c9a74ad2916b986a7626ffb8726db3260d8990a))
* **posts:** add button to show more ([0211de8](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/0211de8fe54ad9c1b494b824ba59183041b9f91f))
* **posts:** restore window scroll service ([3a4b521](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/3a4b521cf5106f8175897d2c09a8963d56d279dc))
### Bug Fixes
* default limit ([2a9a707](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/2a9a707fc98046d2313b64890485ecaef22439ee))
* no display if empty post ([44f089f](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/44f089f9819b8d6dedafa39cd470adf38409a67b))
* **posts:** load more posts with tag (cf. MR !225 ) ([2721c9e](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/2721c9e9f86610e43455a1e6ba9d12415c91f29e))
* **posts:** remove scroll service from app component ([6a7d319](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/6a7d319061ee4c4ea6e6d4b32a32b86039844e14))
## [1.16.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v1.15.0...v1.16.0) (2022-03-18) ## [1.16.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v1.15.0...v1.16.0) (2022-03-18)
......
{ {
"name": "pamn", "name": "pamn",
"version": "1.16.0", "version": "1.16.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
{ {
"name": "pamn", "name": "pamn",
"version": "1.16.0", "version": "1.16.1",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve --configuration=fr --proxy-config proxy.conf.json", "start": "ng serve --configuration=fr --proxy-config proxy.conf.json",
......
<div class="app-container"> <div class="app-container">
<app-header></app-header> <app-header></app-header>
<div (scroll)="onScrollDown($event)" class="app-body"> <div class="app-body">
<router-outlet></router-outlet> <router-outlet></router-outlet>
<router-outlet name="print"></router-outlet> <router-outlet name="print"></router-outlet>
<app-footer></app-footer> <app-footer></app-footer>
......
...@@ -5,7 +5,6 @@ import { AuthService } from './services/auth.service'; ...@@ -5,7 +5,6 @@ import { AuthService } from './services/auth.service';
import { RouterListenerService } from './services/routerListener.service'; import { RouterListenerService } from './services/routerListener.service';
import { UpdateService } from './services/update.service'; import { UpdateService } from './services/update.service';
import { PrintService } from './shared/service/print.service'; import { PrintService } from './shared/service/print.service';
import { WindowScrollService } from './shared/service/windowScroll.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -19,7 +18,6 @@ export class AppComponent implements OnInit { ...@@ -19,7 +18,6 @@ export class AppComponent implements OnInit {
public printService: PrintService, public printService: PrintService,
private authService: AuthService, private authService: AuthService,
private profilService: ProfileService, private profilService: ProfileService,
private windowScrollService: WindowScrollService,
private routerListener: RouterListenerService, private routerListener: RouterListenerService,
private updateService: UpdateService, private updateService: UpdateService,
private router: Router private router: Router
...@@ -52,7 +50,4 @@ export class AppComponent implements OnInit { ...@@ -52,7 +50,4 @@ export class AppComponent implements OnInit {
const vh = window.innerHeight * 0.01; const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`); document.documentElement.style.setProperty('--vh', `${vh}px`);
} }
public onScrollDown(event): void {
this.windowScrollService.scrollY.next(event);
}
} }
<div class="section-container no-padding" fxLayout="row" fxLayoutGap="32px"> <div class="section-container no-padding" fxLayout="row" fxLayoutGap="32px">
<div *ngIf="isLoading" class="loader"> <div fxLayout="column" class="list-container" fxLayoutGap="16px">
<img class="loader-gif" src="/assets/gif/loader_circle.gif" alt />
</div>
<div *ngIf="!isLoading" fxLayout="column" class="list-container" fxLayoutGap="16px">
<!-- <div fxLayout="column" *ngIf="displayTags()"> <!-- <div fxLayout="column" *ngIf="displayTags()">
<div fxLayout="row wrap" fxLayoutAlign="none center" fxLayoutGap="8px"> <div fxLayout="row wrap" fxLayoutAlign="none center" fxLayoutGap="8px">
<div <div
...@@ -27,6 +24,14 @@ ...@@ -27,6 +24,14 @@
<app-post-card [post]="news" class="col" *ngFor="let news of allPosts"></app-post-card> <app-post-card [post]="news" class="col" *ngFor="let news of allPosts"></app-post-card>
</div> </div>
</div> </div>
<div *ngIf="isLoading" class="loader">
<img class="loader-gif" src="/assets/gif/loader_circle.gif" alt />
</div>
<div *ngIf="!isLastPage && !isLoading" fxLayout="row" fxLayoutAlign="center center">
<button class="btn-primary small" (click)="loadMore()">
<div class="rowBtn" fxLayout="row" fxLayoutAlign="center center">Voir plus</div>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -27,9 +27,7 @@ h2 { ...@@ -27,9 +27,7 @@ h2 {
} }
} }
.list-container { .list-container {
@media #{$tablet} { width: 100%;
width: 100%;
}
h2 { h2 {
@media #{$large-phone} { @media #{$large-phone} {
...@@ -239,3 +237,6 @@ h2 { ...@@ -239,3 +237,6 @@ h2 {
margin-bottom: 0; margin-bottom: 0;
} }
} }
.btn-primary {
margin-bottom: 20px;
}
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { WindowScrollService } from '../../../shared/service/windowScroll.service';
import { TagEnum } from '../../enum/tag.enum'; import { TagEnum } from '../../enum/tag.enum';
import { Pagination } from '../../models/pagination.model'; import { Pagination } from '../../models/pagination.model';
import { Post } from '../../models/post.model'; import { Post } from '../../models/post.model';
...@@ -24,21 +23,9 @@ export class PostListComponent implements OnInit { ...@@ -24,21 +23,9 @@ export class PostListComponent implements OnInit {
public pagination: Pagination; public pagination: Pagination;
public isLoading = false; public isLoading = false;
public isPublishMode = false; public isPublishMode = false;
public isLastPage: boolean;
constructor( constructor(private postService: PostService, private route: ActivatedRoute, private router: Router) {}
private postService: PostService,
private windowScrollService: WindowScrollService,
private route: ActivatedRoute,
private router: Router
) {
this.windowScrollService.scrollY$.subscribe((evt: any) => {
if (evt && evt.target.offsetHeight + evt.target.scrollTop >= evt.target.scrollHeight - 200) {
if (!this.isLoading) {
this.loadMore();
}
}
});
}
ngOnInit(): void { ngOnInit(): void {
this.isLoading = true; this.isLoading = true;
...@@ -77,12 +64,15 @@ export class PostListComponent implements OnInit { ...@@ -77,12 +64,15 @@ export class PostListComponent implements OnInit {
*/ */
public fillArticles(news: PostWithMeta): void { public fillArticles(news: PostWithMeta): void {
this.setNews(news); this.setNews(news);
news.meta.pagination.pages > news.meta.pagination.page ? (this.isLastPage = false) : (this.isLastPage = true);
const headLineTag = this.allPosts.filter((post: Post) => const headLineTag = this.allPosts.filter((post: Post) =>
post.tags.some((tag) => tag && tag.slug === TagEnum.aLaUne) post.tags.some((tag) => tag && tag.slug === TagEnum.aLaUne)
); );
const headIndex = this.allPosts.findIndex((post) => post.id === headLineTag[0].id); if (headLineTag.length) {
this.allPosts.splice(headIndex, 1); const headIndex = this.allPosts.findIndex((post) => post.id === headLineTag[0].id);
this.allPosts.splice(headIndex, 1);
}
this.allPosts = [...headLineTag, ..._.difference(this.allPosts, headLineTag)]; this.allPosts = [...headLineTag, ..._.difference(this.allPosts, headLineTag)];
} }
...@@ -127,12 +117,12 @@ export class PostListComponent implements OnInit { ...@@ -127,12 +117,12 @@ export class PostListComponent implements OnInit {
// Transform excerpt post to have a custom author. // Transform excerpt post to have a custom author.
private addAuthorToPost(post: Post): Post { private addAuthorToPost(post: Post): Post {
post.author = post.excerpt; post.author = post.excerpt;
post.excerpt = post.html.replace(/<[^>]*>/g, ''); if (post.html) post.excerpt = post.html.replace(/<[^>]*>/g, '');
return post; return post;
} }
// Load more news on scroll event. // Load more news on scroll event.
private loadMore(): void { public loadMore(): void {
if (this.pagination && this.pagination.page < this.pagination.pages) { if (this.pagination && this.pagination.page < this.pagination.pages) {
this.isLoading = true; this.isLoading = true;
if (this.filters) { if (this.filters) {
...@@ -148,10 +138,8 @@ export class PostListComponent implements OnInit { ...@@ -148,10 +138,8 @@ export class PostListComponent implements OnInit {
// Split news on two columns on desktop mode or one column in mobile mode. // Split news on two columns on desktop mode or one column in mobile mode.
private setNews(news: PostWithMeta): void { private setNews(news: PostWithMeta): void {
this.pagination = news.meta.pagination; this.pagination = news.meta.pagination;
const customIndex = this.allPosts.length; // For scroll loading, start with previous index. const newPosts = news.posts.map((val) => {
const newPosts = news.posts.map((val, index) => {
val = this.addAuthorToPost(val); val = this.addAuthorToPost(val);
index += customIndex;
return val; return val;
}); });
this.allPosts = [...this.allPosts, ...newPosts]; this.allPosts = [...this.allPosts, ...newPosts];
......
...@@ -22,9 +22,11 @@ export class PostService { ...@@ -22,9 +22,11 @@ export class PostService {
); );
} }
public getPosts(page: number, tags?: string[]): Observable<PostWithMeta> { /**
* 12 posts to fit new design (1 + 3 + 2 + 1 + 3 + 2)
*/
public getPosts(page: number, tags?: string[], limit: string = '12'): Observable<PostWithMeta> {
let tagsFilter = ''; let tagsFilter = '';
if (tags) { if (tags) {
let tagsString = ''; let tagsString = '';
// Transform tab filters to string filters // Transform tab filters to string filters
...@@ -37,7 +39,7 @@ export class PostService { ...@@ -37,7 +39,7 @@ export class PostService {
tagsFilter = `&filter=tags:${encodeURIComponent(tagsString)}`; tagsFilter = `&filter=tags:${encodeURIComponent(tagsString)}`;
} }
return this.http.get<PostWithMeta>(`${this.baseUrl}?page=${page}&include=tags,authors${tagsFilter}`); return this.http.get<PostWithMeta>(`${this.baseUrl}?page=${page}&include=tags,authors${tagsFilter}&limit=${limit}`);
} }
public getTags(): Observable<TagWithMeta> { public getTags(): Observable<TagWithMeta> {
...@@ -46,7 +48,7 @@ export class PostService { ...@@ -46,7 +48,7 @@ export class PostService {
private addAuthorToPost(post: Post): Post { private addAuthorToPost(post: Post): Post {
post.author = post.excerpt; post.author = post.excerpt;
post.excerpt = post.html.replace(/<[^>]*>/g, ''); if (post.html) post.excerpt = post.html.replace(/<[^>]*>/g, '');
return post; return post;
} }
} }