From e9d3588542bba4f9a037efcc807a068fb159bae9 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Fri, 8 Mar 2019 18:05:08 +0100
Subject: [PATCH] FIX #9514 fix modal css

---
 ...ministration-redirect-modal.component.html |   2 +-
 ...ministration-redirect-modal.component.html | 160 ++++++++++--------
 .../user/users-administration.component.ts    |   6 +
 3 files changed, 92 insertions(+), 76 deletions(-)

diff --git a/src/frontend/app/administration/user/user-administration-redirect-modal.component.html b/src/frontend/app/administration/user/user-administration-redirect-modal.component.html
index 00659ec6f17..a6f1e53b020 100755
--- a/src/frontend/app/administration/user/user-administration-redirect-modal.component.html
+++ b/src/frontend/app/administration/user/user-administration-redirect-modal.component.html
@@ -1,4 +1,4 @@
-<h2 mat-dialog-title>{{lang.redirects}}</h2>
+<h1 mat-dialog-title>{{lang.redirects}}</h1>
 <mat-dialog-content style="overflow:inherit;">
     <form #redirectConfForm="ngForm">
         <div class="modal-body">
diff --git a/src/frontend/app/administration/user/users-administration-redirect-modal.component.html b/src/frontend/app/administration/user/users-administration-redirect-modal.component.html
index 5a7536ec4c7..4ad6a1e8fdc 100755
--- a/src/frontend/app/administration/user/users-administration-redirect-modal.component.html
+++ b/src/frontend/app/administration/user/users-administration-redirect-modal.component.html
@@ -1,87 +1,95 @@
+<h1 mat-dialog-title>{{modalTitle}}</h1>
+
 <form #changeDiffListDestForm="ngForm">
     <div>
-        <mat-dialog-content *ngIf="data.isDeletable">    
-            <div class="modal-body" *ngIf="data.inDiffListDest">
-                <h2 mat-dialog-title>{{lang.redirectUserListDiff}}</h2>
-                <div class="alert alert-warning" role="alert">
-                    <b>{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;<span [innerHTML]="lang.chooseNewDest"></span> :
-                </div>
+        <ng-container *ngIf="data.isDeletable">
+            <mat-dialog-content>
+                <div class="modal-body" *ngIf="data.inDiffListDest">
+                    <h2>{{lang.redirectUserListDiff}}</h2>
+                    <div class="alert alert-warning" role="alert">
+                        <b>{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;<span
+                            [innerHTML]="lang.chooseNewDest"></span> :
+                    </div>
 
-                <div *ngFor="let redirectModel of data.redirectListModels; index as i" id="{{redirectModel.object_id}}" class="form-group">
-                    <mat-form-field class="example-full-width">
-                        <input name="redirectModel_{{i}}" id="redirectModel_{{i}}" [(ngModel)]="redirectModel.redirectUserId"
-                            type="text" placeholder="{{lang.newDest}} : {{redirectModel.title}}" matInput [matAutocomplete]="auto"
-                            [formControl]="userCtrl" required>
-                        <mat-autocomplete #auto="matAutocomplete">
-                            <ng-container *ngFor="let user of filteredUsers | async">
-                                <mat-option [value]="user.id" *ngIf="this.data.userDestRedirect.user_id != user.id">
-                                    <div class="container-fluid">
-                                        <span class="col-xm-1">
-                                            <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
-                                        </span>
-                                        <span class="col-xm-11">
-                                            {{ user.idToDisplay }}
-                                            <small>{{ user.otherInfo }}</small>
-                                        </span>
-                                    </div>
-                                </mat-option>
-                            </ng-container>
-                        </mat-autocomplete>
-                    </mat-form-field>
+                    <div *ngFor="let redirectModel of data.redirectListModels; index as i" id="{{redirectModel.object_id}}"
+                        class="form-group">
+                        <mat-form-field class="example-full-width">
+                            <input name="redirectModel_{{i}}" id="redirectModel_{{i}}" [(ngModel)]="redirectModel.redirectUserId"
+                                type="text" placeholder="{{lang.newDest}} : {{redirectModel.title}}" matInput
+                                [matAutocomplete]="auto" [formControl]="userCtrl" required>
+                            <mat-autocomplete #auto="matAutocomplete">
+                                <ng-container *ngFor="let user of filteredUsers | async">
+                                    <mat-option [value]="user.id" *ngIf="this.data.userDestRedirect.user_id != user.id">
+                                        <div class="container-fluid">
+                                            <span class="col-xm-1">
+                                                <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
+                                            </span>
+                                            <span class="col-xm-11">
+                                                {{ user.idToDisplay }}
+                                                <small>{{ user.otherInfo }}</small>
+                                            </span>
+                                        </div>
+                                    </mat-option>
+                                </ng-container>
+                            </mat-autocomplete>
+                        </mat-form-field>
+                    </div>
                 </div>
-            </div>
 
-            <div class="modal-body" *ngIf="data.isResDestUser">
-                <h2 mat-dialog-title>{{lang.redirectUserListInstances}}</h2>
-                <div class="alert alert-warning" role="alert">
-                    <b>{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;<span [innerHTML]="lang.chooseNewDestUser"></span> :
-                </div>
+                <div class="modal-body" *ngIf="data.isResDestUser">
+                    <h2>{{lang.redirectUserListInstances}}</h2>
+                    <div class="alert alert-warning" role="alert">
+                        <b>{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;<span
+                            [innerHTML]="lang.chooseNewDestUser"></span> :
+                    </div>
 
-                <div id="{{this.data.userDestRedirect.user_id}}" class="form-group">
-                    <mat-form-field class="example-full-width">
-                        <input name="redirectModel_resDest" id="redirectModel_resDest" [(ngModel)]="this.data.redirectDestResUserId"
-                            type="text" placeholder="{{lang.newDestRes}} : " matInput [matAutocomplete]="auto"
-                            [formControl]="userCtrl" required>
-                        <mat-autocomplete #auto="matAutocomplete">
-                            <ng-container *ngFor="let user of filteredUsers | async">
-                                <mat-option [value]="user.id" *ngIf="this.data.userDestRedirect.user_id != user.id">
-                                    <div class="container-fluid">
-                                        <span class="col-xm-1">
-                                            <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
-                                        </span>
-                                        <span class="col-xm-11">
-                                            {{ user.idToDisplay }}
-                                            <small>{{ user.otherInfo }}</small>
-                                        </span>
-                                    </div>
-                                </mat-option>
-                            </ng-container>
-                        </mat-autocomplete>
-                    </mat-form-field>
+                    <div id="{{this.data.userDestRedirect.user_id}}" class="form-group">
+                        <mat-form-field class="example-full-width">
+                            <input name="redirectModel_resDest" id="redirectModel_resDest" [(ngModel)]="this.data.redirectDestResUserId"
+                                type="text" placeholder="{{lang.newDestRes}} : " matInput [matAutocomplete]="auto"
+                                [formControl]="userCtrl" required>
+                            <mat-autocomplete #auto="matAutocomplete">
+                                <ng-container *ngFor="let user of filteredUsers | async">
+                                    <mat-option [value]="user.id" *ngIf="this.data.userDestRedirect.user_id != user.id">
+                                        <div class="container-fluid">
+                                            <span class="col-xm-1">
+                                                <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
+                                            </span>
+                                            <span class="col-xm-11">
+                                                {{ user.idToDisplay }}
+                                                <small>{{ user.otherInfo }}</small>
+                                            </span>
+                                        </div>
+                                    </mat-option>
+                                </ng-container>
+                            </mat-autocomplete>
+                        </mat-form-field>
+                    </div>
                 </div>
-            </div>
 
-            <div class="modal-body" *ngIf="!data.inDiffListDest && !data.isResDestUser">
-                <h2 mat-dialog-title>{{lang.confirmAction}}</h2>
-                <div class="alert" role="alert">
-                    <b *ngIf="data.userDestRedirect.mode == 'delete'">{{lang.delete}} {{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;
-                    <b *ngIf="data.userDestRedirect.mode == 'suspend'">{{lang.suspend}} {{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;
+                <div class="modal-body" *ngIf="!data.inDiffListDest && !data.isResDestUser">
+                    <div class="alert" role="alert">
+                        <b *ngIf="data.userDestRedirect.mode == 'delete'">{{lang.delete}}
+                            {{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;
+                        <b *ngIf="data.userDestRedirect.mode == 'suspend'">{{lang.suspend}}
+                            {{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;
+                    </div>
                 </div>
-            </div>
 
-        </mat-dialog-content>
+            </mat-dialog-content>
+        </ng-container>
 
-        <mat-dialog-content *ngIf="!data.isDeletable">   
+        <ng-container *ngIf="!data.isDeletable">
+            <mat-dialog-content>
                 <div class="modal-body">
-                    <h2 mat-dialog-title *ngIf="this.data.userDestRedirect.mode == 'delete'">{{lang.unableToDelete}}</h2>
-                    <h2 mat-dialog-title *ngIf="this.data.userDestRedirect.mode == 'suspend'">{{lang.unableToSuspend}}</h2>
                     <div class="alert alert-warning" role="alert">
-                        <p><span [innerHTML]="lang.userIsNotDeletable"></span> <b>{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;</p>
+                        <p><span [innerHTML]="lang.userIsNotDeletable"></span> <b>{{this.data.userDestRedirect.firstname}}
+                                {{this.data.userDestRedirect.lastname}}</b>&nbsp;</p>
                         <p><span [innerHTML]="lang.userIsDeletableBy"></span></p>
                     </div>
                 </div>
 
-                <div class="modal-body" *ngIf="data.inTemplateList" class="col-md-6">                       
+                <div class="modal-body" *ngIf="data.inTemplateList" class="col-md-6">
                     <mat-list>
                         <p mat-line>{{lang.diffusionList}}</p>
                         <mat-list-item *ngFor="let templateEntity of data.listTemplateEntities">
@@ -100,15 +108,17 @@
                         </mat-list-item>
                     </mat-list>
                 </div>
-        </mat-dialog-content>    
-           
+            </mat-dialog-content>
+        </ng-container>
+
         <mat-dialog-actions>
-            <button mat-raised-button color="warn" *ngIf="data.userDestRedirect.mode == 'delete' && data.isDeletable" type="submit" class="btn btn-danger" (click)="dialogRef.close(this.data)"
-                [disabled]="!sendFunction()">{{lang.delete}} {{lang.user}}</button>
-            <button mat-raised-button color="primary" *ngIf="data.userDestRedirect.mode == 'suspend' && data.isDeletable" type="submit" (click)="dialogRef.close(this.data)"
-                [disabled]="!sendFunction()">{{lang.suspend}} {{lang.user}}</button>
-            <button mat-raised-button color="primary" *ngIf="!data.isDeletable" type="submit" (click)="dialogRef.close()"
-                                            >{{lang.close}}</button>    
+            <button mat-raised-button color="warn" *ngIf="data.userDestRedirect.mode == 'delete' && data.isDeletable"
+                type="submit" class="btn btn-danger" (click)="dialogRef.close(this.data)" [disabled]="!sendFunction()">{{lang.delete}}
+                {{lang.user}}</button>
+            <button mat-raised-button color="primary" *ngIf="data.userDestRedirect.mode == 'suspend' && data.isDeletable"
+                type="submit" (click)="dialogRef.close(this.data)" [disabled]="!sendFunction()">{{lang.suspend}}
+                {{lang.user}}</button>
+            <button mat-raised-button color="primary" *ngIf="!data.isDeletable" type="submit" (click)="dialogRef.close()">{{lang.close}}</button>
         </mat-dialog-actions>
     </div>
 </form>
\ No newline at end of file
diff --git a/src/frontend/app/administration/user/users-administration.component.ts b/src/frontend/app/administration/user/users-administration.component.ts
index 6201bc14cc4..4db5f6ae42f 100755
--- a/src/frontend/app/administration/user/users-administration.component.ts
+++ b/src/frontend/app/administration/user/users-administration.component.ts
@@ -414,6 +414,7 @@ export class UsersAdministrationRedirectModalComponent extends AutoCompletePlugi
     lang: any               = LANG;
     loadModel: boolean      = false;
     loadInstance: boolean   = false;
+    modalTitle: string      = this.lang.confirmAction;
 
     constructor(public http: HttpClient, @Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef<UsersAdministrationRedirectModalComponent>) {
         super(http, ['users']);
@@ -432,6 +433,11 @@ export class UsersAdministrationRedirectModalComponent extends AutoCompletePlugi
                 this.data.isResDestUser = true;
             }
         } else {
+            if (this.data.userDestRedirect.mode == 'delete') {
+                this.modalTitle = this.lang.unableToDelete;
+            } else {
+                this.modalTitle = this.lang.unableToSuspend;
+            }
             //get listModel
             if (this.data.listTemplateEntities.length > 0) {
                 this.data.inTemplateList = true;
-- 
GitLab