From b9beb70bd38947412f4aa24c711743fd6ca2ed19 Mon Sep 17 00:00:00 2001 From: Etienne LOUPIAS <eloupias@grandlyon.com> Date: Tue, 26 Mar 2024 15:49:31 +0100 Subject: [PATCH 1/5] fix(structure): edit page reload redirect to home --- src/app/guards/role.guard.ts | 6 +++--- src/app/profile/services/profile.service.ts | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/guards/role.guard.ts b/src/app/guards/role.guard.ts index a98f13aed..216256537 100644 --- a/src/app/guards/role.guard.ts +++ b/src/app/guards/role.guard.ts @@ -1,5 +1,5 @@ -import { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router'; import { Injectable } from '@angular/core'; +import { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router'; import { ProfileService } from '../profile/services/profile.service'; import { AuthService } from '../services/auth.service'; import { RouteRole } from '../shared/enum/routeRole.enum'; @@ -15,14 +15,14 @@ export class RoleGuard { private authService: AuthService, ) {} - canActivate(route: ActivatedRouteSnapshot): UrlTree | boolean { + async canActivate(route: ActivatedRouteSnapshot): Promise<UrlTree | boolean> { const allowedRoles = route.data.allowedRoles; if (this.authService.isLoggedIn()) { if (this.profileService.isAdmin()) return true; if (allowedRoles.includes(RouteRole.structureAdmin)) { const structureId = route.params.id; - if (this.profileService.isLinkedToStructure(structureId)) { + if (await this.profileService.isLinkedToStructure(structureId)) { return true; } } diff --git a/src/app/profile/services/profile.service.ts b/src/app/profile/services/profile.service.ts index b740c65af..363580320 100644 --- a/src/app/profile/services/profile.service.ts +++ b/src/app/profile/services/profile.service.ts @@ -1,7 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import decode from 'jwt-decode'; -import { Observable } from 'rxjs'; +import { Observable, lastValueFrom } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { Employer } from '../../models/employer.model'; import { Job } from '../../models/job.model'; @@ -25,7 +25,7 @@ export class ProfileService { public async getProfile(): Promise<User> { if (this.authService.isLoggedIn()) { - const profile = await this.http.get<User>(`${this.baseUrl}/profile`).toPromise(); + const profile = await lastValueFrom(this.http.get<User>(`${this.baseUrl}/profile`)); this.currentProfile = profile; } return this.currentProfile; @@ -38,7 +38,8 @@ export class ProfileService { return this.http.delete<User>(`${this.baseUrl}`); } - public isLinkedToStructure(idStructure: string): boolean { + public async isLinkedToStructure(idStructure: string): Promise<boolean> { + await this.getProfile(); if (!this.currentProfile) { return false; } -- GitLab From dacebfd6c8b1ccdba3aba66d0b65da20d499ea9a Mon Sep 17 00:00:00 2001 From: Pierre Ecarlat <pecarlat@grandlyon.com> Date: Wed, 27 Mar 2024 09:10:47 +0100 Subject: [PATCH 2/5] Make collapsed default to true and changed text in orientation --- .../personal-offer-accompaniment.component.html | 2 +- .../personal-offer-training-type.component.html | 2 +- .../training-type-picker/training-type-picker.component.html | 2 +- .../training-type-picker/training-type-picker.component.ts | 5 ----- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/form/form-view/personal-offer-form/personal-offer-accompaniment/personal-offer-accompaniment.component.html b/src/app/form/form-view/personal-offer-form/personal-offer-accompaniment/personal-offer-accompaniment.component.html index e7b46ff2d..e51fc8bc8 100644 --- a/src/app/form/form-view/personal-offer-form/personal-offer-accompaniment/personal-offer-accompaniment.component.html +++ b/src/app/form/form-view/personal-offer-form/personal-offer-accompaniment/personal-offer-accompaniment.component.html @@ -1,7 +1,7 @@ <form *ngIf="personalOfferForm" [formGroup]="personalOfferForm"> <div class="title"> <p class="overtitle">{{ structureName }}</p> - <h3>Quelles aides aux démarches en ligne proposez-vous ?</h3> + <h3>Quelles aides aux démarches en ligne proposez-vous dans cette structure ?</h3> <p>Facultatif - Plusieurs choix possibles</p> </div> diff --git a/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.html b/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.html index fef2754c7..a8a261b1e 100644 --- a/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.html +++ b/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.html @@ -1,7 +1,7 @@ <form *ngIf="personalOfferForm" [formGroup]="personalOfferForm"> <div class="title"> <p class="overtitle">{{ structureName }}</p> - <h3>Quels accompagnements au numérique proposez-vous ?</h3> + <h3>Quels accompagnements au numérique proposez-vous dans cette structure ?</h3> <p>Facultatif</p> </div> <app-training-type-picker diff --git a/src/app/shared/components/training-type-picker/training-type-picker.component.html b/src/app/shared/components/training-type-picker/training-type-picker.component.html index 1b031728b..03741b86b 100644 --- a/src/app/shared/components/training-type-picker/training-type-picker.component.html +++ b/src/app/shared/components/training-type-picker/training-type-picker.component.html @@ -1,5 +1,5 @@ <div class="trainingContainer"> - <app-collapse *ngFor="let category of categories" [expanded]="isCategorieExpanded(category.id)"> + <app-collapse *ngFor="let category of categories" [expanded]="true"> <app-collapse-header> <div class="collapseHeader"> <app-checkbox diff --git a/src/app/shared/components/training-type-picker/training-type-picker.component.ts b/src/app/shared/components/training-type-picker/training-type-picker.component.ts index 373ab003d..3ff3d20af 100644 --- a/src/app/shared/components/training-type-picker/training-type-picker.component.ts +++ b/src/app/shared/components/training-type-picker/training-type-picker.component.ts @@ -47,11 +47,6 @@ export class TrainingTypePickerComponent implements OnInit, OnChanges { }); } - public isCategorieExpanded(id: string): boolean { - const index = this.selectedChoices.findIndex((category) => category.id === id); - return this.selectedChoices[index].modules.length !== 0; - } - public isModulePicked(categorie: Category, module: Module): boolean { const index = this.selectedChoices.findIndex((_categorie) => _categorie.id === categorie.id); if (index === -1) return false; -- GitLab From 822843c44abbc3f65f27635daf8504f655743c63 Mon Sep 17 00:00:00 2001 From: Mathieu Ponton <mponton@grandlyon.com> Date: Wed, 27 Mar 2024 14:28:51 +0000 Subject: [PATCH 3/5] fix(post): fix the size of embedded YouTube videos. --- .../post-details/post-details.component.scss | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/post/components/post-details/post-details.component.scss b/src/app/post/components/post-details/post-details.component.scss index 3c8671b56..5f678e4f4 100644 --- a/src/app/post/components/post-details/post-details.component.scss +++ b/src/app/post/components/post-details/post-details.component.scss @@ -47,6 +47,7 @@ h1 { } .description { + position: relative; a { font-size: $font-size-small; color: $red; @@ -64,11 +65,6 @@ h1 { ::ng-deep img { height: 100%; } - ::ng-deep iframe { - width: 100% !important; - max-height: 400px; - height: 100vw; - } ::ng-deep .kg-embed-card { max-height: 400px; iframe { @@ -83,4 +79,9 @@ h1 { text-align: center; } } + iframe { + position: relative; + width: 100%; + height: 400px; + } } -- GitLab From e6ded6a0718ffb121f30dc7e0117a9337c38b5d1 Mon Sep 17 00:00:00 2001 From: Pierre Ecarlat <pecarlat@grandlyon.com> Date: Thu, 28 Mar 2024 09:14:00 +0000 Subject: [PATCH 4/5] fix: Some fixes --- .../hour-picker/hour-picker.component.html | 4 ++-- .../components/hour-picker/hour-picker.component.ts | 4 ++-- .../structure-details.component.html | 13 ++++++++++--- .../structure-details.component.ts | 6 ++++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/app/shared/components/hour-picker/hour-picker.component.html b/src/app/shared/components/hour-picker/hour-picker.component.html index b52deadd1..4cf6b42b8 100644 --- a/src/app/shared/components/hour-picker/hour-picker.component.html +++ b/src/app/shared/components/hour-picker/hour-picker.component.html @@ -19,7 +19,7 @@ [label]="'De :'" [size]="'large'" [status]="getStatus(hour.start)" - [statusText]="getStatusText(hour)" + [statusText]="getStatusText(hour.start)" [(value)]="hour.start" (valueChange)="submitForm()" /> @@ -31,7 +31,7 @@ [label]="'Jusqu’à :'" [size]="'large'" [status]="getStatus(hour.start, hour.end)" - [statusText]="getStatusText(hour)" + [statusText]="getStatusText(hour.start, hour.end)" [(value)]="hour.end" (valueChange)="submitForm()" /> diff --git a/src/app/shared/components/hour-picker/hour-picker.component.ts b/src/app/shared/components/hour-picker/hour-picker.component.ts index 88616a331..217fd8a14 100644 --- a/src/app/shared/components/hour-picker/hour-picker.component.ts +++ b/src/app/shared/components/hour-picker/hour-picker.component.ts @@ -174,7 +174,7 @@ export class HourPickerComponent implements OnInit { return end && end > start ? 'success' : 'error'; } - getStatusText(hour: { start: string; end: string }): string { - return 'Horaire ' + (this.getStatus(hour.start, hour.end) === 'error' ? 'invalide' : 'valide'); + getStatusText(start: string, end?: string): string { + return 'Horaire ' + (this.getStatus(start, end) === 'error' ? 'invalide' : 'valide'); } } diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index e6ba1b6cc..cdc28cb54 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -21,7 +21,14 @@ [clickable]="false" /> </div> - <app-svg-icon tabindex="0" [folder]="'ico'" [icon]="'cross'" [iconColor]="'grey-1'" (click)="close()" (keyup.enter)="close()" /> + <app-svg-icon + tabindex="0" + [folder]="'ico'" + [icon]="'cross'" + [iconColor]="'grey-1'" + (click)="close()" + (keyup.enter)="close()" + /> </section> <section *ngIf="showButtons" class="actions hide-on-print"> @@ -66,7 +73,7 @@ </div> <!-- Je travaille ici --> <div - *ngIf="!profileService.isLinkedToStructure(structure._id)" + *ngIf="!isInStructure" class="clickableDiv" role="button" tabindex="0" @@ -78,7 +85,7 @@ </div> <!-- Modifier la structure --> <div - *ngIf="profileService.isLinkedToStructure(structure._id) || profileService.isAdmin()" + *ngIf="isInStructure || profileService.isAdmin()" class="clickableDiv" role="button" tabindex="0" diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index bf023d609..973eba153 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -56,6 +56,7 @@ export class StructureDetailsComponent implements OnInit { public showButtons = true; public Equipment = Equipment; public FreeWorkshop = FreeWorkshop; + public isInStructure = false; constructor( private searchService: SearchService, @@ -74,6 +75,7 @@ export class StructureDetailsComponent implements OnInit { if (queryParams.id) { this.structureService.getStructure(queryParams.id).subscribe((structure) => { this.structure = new Structure(structure); + this.profileIsLinkedToStructure(this.structure._id); this.isLoading = true; this.initForm(); }); @@ -107,6 +109,10 @@ export class StructureDetailsComponent implements OnInit { }); } + public async profileIsLinkedToStructure(id: string): Promise<void> { + this.isInStructure = await this.profileService.isLinkedToStructure(id); + } + public userIsLoggedIn(): boolean { return this.authService.isLoggedIn(); } -- GitLab From ec2828af19d304583ec745acc5342e215988e1f9 Mon Sep 17 00:00:00 2001 From: Etienne LOUPIAS <eloupias@grandlyon.com> Date: Thu, 28 Mar 2024 10:19:28 +0100 Subject: [PATCH 5/5] chore(release): 3.0.2 --- CHANGELOG.md | 10 ++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2f6cc08..649e6c962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ 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. +### [3.0.2](https://forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v3.0.1...v3.0.2) (2024-03-28) + + +### Bug Fixes + +* **post:** fix the size of embedded YouTube videos. ([7079f79](https://forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/7079f7900b7098bc3c7696f02ffacb839f0a8ba0)) +* **post:** fix the size of embedded YouTube videos. ([822843c](https://forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/822843c44abbc3f65f27635daf8504f655743c63)) +* Some fixes ([e6ded6a](https://forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/e6ded6a0718ffb121f30dc7e0117a9337c38b5d1)) +* **structure:** edit page reload redirect to home ([b9beb70](https://forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/b9beb70bd38947412f4aa24c711743fd6ca2ed19)) + ### [3.0.1](https://forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v3.0.0...v3.0.1) (2024-03-27) diff --git a/package-lock.json b/package-lock.json index cbccf0363..6dc94f90e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pamn", - "version": "3.0.1", + "version": "3.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pamn", - "version": "3.0.1", + "version": "3.0.2", "dependencies": { "@ag-grid-community/csv-export": "^29.0.0", "@angular/animations": "^17.0.7", diff --git a/package.json b/package.json index 5d90b52df..5595773e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pamn", - "version": "3.0.1", + "version": "3.0.2", "scripts": { "ng": "ng", "start": "ng serve --configuration=local,fr --proxy-config proxy.conf.json", -- GitLab