From b7afb283e99d7a58f14eef27432c6f2164eeb3a2 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Mon, 6 Jan 2020 16:08:53 +0100 Subject: [PATCH] FEAT #11403 TIME 0:20 moved follow icon in process --- .../indexing-form.component.html | 2 +- .../indexing-form/indexing-form.component.ts | 18 --------------- .../app/process/process.component.html | 13 +++++------ src/frontend/app/process/process.component.ts | 22 +++++++++++++++++++ 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.html b/src/frontend/app/indexation/indexing-form/indexing-form.component.html index e4bc43357cc..7049a0574d6 100644 --- a/src/frontend/app/indexation/indexing-form/indexing-form.component.html +++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.html @@ -2,7 +2,7 @@ <mat-spinner style="margin:auto;"></mat-spinner> </div> <ng-container *ngIf="!loading"> - <div *ngIf="!adminMode" + <div *ngIf="!adminMode && mode == 'indexation'" style="display: flex;align-items: center;justify-content: flex-end;margin-top: 10px;margin-bottom: -20px;"> <button mat-button class="categoryLabel" (click)="toggleMailTracking()" [title]="arrFormControl['mailÂtracking'].value ? lang.untrackThisMail : lang.trackThisMail"> diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts index b057f00dfcf..ebf9b88d041 100644 --- a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts +++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts @@ -883,24 +883,6 @@ export class IndexingFormComponent implements OnInit { toggleMailTracking() { this.arrFormControl['mailÂtracking'].setValue(!this.arrFormControl['mailÂtracking'].value); - - if (this.mode !== 'indexation') { - if (this.arrFormControl['mailÂtracking'].value) { - this.http.post('../../rest/resources/follow', {resources: [this.resId]}).pipe( - catchError((err: any) => { - this.notify.handleErrors(err); - return of(false); - }) - ).subscribe(); - } else { - this.http.request('DELETE', '../../rest/resources/unfollow', { body: { resources: [this.resId] } }).pipe( - catchError((err: any) => { - this.notify.handleErrors(err); - return of(false); - }) - ).subscribe(); - } - } } changeCategory(categoryId: string) { diff --git a/src/frontend/app/process/process.component.html b/src/frontend/app/process/process.component.html index 1ea25fe2e24..9a6c3a640d8 100644 --- a/src/frontend/app/process/process.component.html +++ b/src/frontend/app/process/process.component.html @@ -25,13 +25,6 @@ <ng-container *ngIf="currentTool === 'dashboard'"> <div style="display: flex;align-items: center;justify-content: flex-end;margin-top: 10px;margin-bottom: -20px;"> - <button mat-button class="categoryLabel" (click)="toggleMailTracking()" - [title]="currentResourceInformations.mailtracking ? lang.untrackThisMail : lang.trackThisMail"> - {{currentResourceInformations.mailtracking ? lang.untrackThisMail : lang.trackThisMail}} - <mat-icon color="primary" - class="{{currentResourceInformations.mailtracking ? 'fas':'far'}} fa-star" - style="font-size: 20px;"></mat-icon> - </button> </div> <div class="banner" [style.borderColor]="currentPriorityColor"> <div class="title" (click)="currentTool = 'history'"> @@ -172,6 +165,10 @@ <div class="title-divider"></div> </div> <div class="content"> + <button mat-button class="categoryLabel" (click)="toggleFollow()"> + <mat-icon color="primary" class="{{this.resourceFollowed ? 'fas':'far'}} fa-star" + style="font-size: 20px;"></mat-icon> + </button> <div class="content-item" *ngIf="this.currentResourceInformations.priority !== undefined"> <b><i class="fas fa-flag" [style.color]="this.currentResourceInformations.priorityColor" style="font-size: 25px;padding-right: 20px;"></i> @@ -273,4 +270,4 @@ </button> </div> </div> -</div> \ No newline at end of file +</div> diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index 6651bd1db85..1d7692dd56d 100755 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -138,6 +138,8 @@ export class ProcessComponent implements OnInit { senderLightInfo: any = { 'displayName': null, 'fillingRate': null }; hasContact: boolean = false; + resourceFollowed: boolean = false; + constructor( private route: ActivatedRoute, private _activatedRoute: ActivatedRoute, @@ -502,4 +504,24 @@ export class ProcessComponent implements OnInit { return true; } } + + toggleFollow() { + this.resourceFollowed = !this.resourceFollowed; + + if (this.resourceFollowed) { + this.http.post('../../rest/resources/follow', {resources: [this.currentResourceInformations.resId]}).pipe( + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } else { + this.http.request('DELETE', '../../rest/resources/unfollow', {body: {resources: [this.currentResourceInformations.resId]}}).pipe( + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } + } } -- GitLab