Allow final versions without change reco

Alters the creation process of final versions
in a way one can create them independantly
of change recomendations.
This commit is contained in:
Sean Engelhardt 2020-01-29 16:28:36 +01:00
parent a6bdaedff1
commit 27e8301131
2 changed files with 24 additions and 6 deletions

View File

@ -517,8 +517,7 @@
*ngIf=" *ngIf="
motion && motion &&
!motion.isParagraphBasedAmendment() && !motion.isParagraphBasedAmendment() &&
allChangingObjects && ((allChangingObjects && allChangingObjects.length) || motion.modified_final_version)
allChangingObjects.length > 0
" "
> >
<mat-icon>rate_review</mat-icon> <mat-icon>rate_review</mat-icon>
@ -527,17 +526,18 @@
</div> </div>
<!-- Final edit buttons --> <!-- Final edit buttons -->
<div *ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) || isRecoMode(ChangeRecoMode.Final)"> <div *osPerms="'motions.can_manage'">
<!-- create final version --> <!-- create final version -->
<button <button
type="button" type="button"
mat-icon-button mat-icon-button
matTooltip="{{ 'Create final print template' | translate }}" matTooltip="{{ 'Create final print template' | translate }}"
*osPerms="'motions.can_manage'; and: isRecoMode(ChangeRecoMode.Final)" *ngIf="motion.state.isFinalState"
(click)="createModifiedFinalVersion()" (click)="createModifiedFinalVersion()"
> >
<mat-icon>file_copy</mat-icon> <mat-icon>file_copy</mat-icon>
</button> </button>
<!-- edit final version --> <!-- edit final version -->
<button <button
type="button" type="button"
@ -570,9 +570,9 @@
<button <button
type="button" type="button"
class="red-warning-text" class="red-warning-text"
*ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && !isFinalEdit"
mat-icon-button mat-icon-button
matTooltip="{{ 'Delete final print template' | translate }}" matTooltip="{{ 'Delete final print template' | translate }}"
*ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && !isFinalEdit"
(click)="deleteModifiedFinalVersion()" (click)="deleteModifiedFinalVersion()"
> >
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
@ -956,6 +956,7 @@
translate translate
(click)="setChangeRecoMode(ChangeRecoMode.Changed)" (click)="setChangeRecoMode(ChangeRecoMode.Changed)"
[ngClass]="{ selected: crMode === ChangeRecoMode.Changed }" [ngClass]="{ selected: crMode === ChangeRecoMode.Changed }"
*ngIf="allChangingObjects && allChangingObjects.length"
> >
Changed version Changed version
</button> </button>
@ -964,6 +965,7 @@
translate translate
(click)="setChangeRecoMode(ChangeRecoMode.Diff)" (click)="setChangeRecoMode(ChangeRecoMode.Diff)"
[ngClass]="{ selected: crMode === ChangeRecoMode.Diff }" [ngClass]="{ selected: crMode === ChangeRecoMode.Diff }"
*ngIf="allChangingObjects && allChangingObjects.length"
> >
Diff version Diff version
</button> </button>
@ -972,6 +974,7 @@
translate translate
(click)="setChangeRecoMode(ChangeRecoMode.Final)" (click)="setChangeRecoMode(ChangeRecoMode.Final)"
[ngClass]="{ selected: crMode === ChangeRecoMode.Final }" [ngClass]="{ selected: crMode === ChangeRecoMode.Final }"
*ngIf="allChangingObjects && allChangingObjects.length"
> >
Final version Final version
</button> </button>

View File

@ -504,7 +504,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
.subscribe(mode => (this.lnMode = mode)); .subscribe(mode => (this.lnMode = mode));
this.configService this.configService
.get<ChangeRecoMode>('motions_recommendation_text_mode') .get<ChangeRecoMode>('motions_recommendation_text_mode')
.subscribe(mode => (this.crMode = mode)); .subscribe(mode => (this.crMode = this.determineCrMode(mode)));
this.configService this.configService
.get<boolean>('motions_show_sequential_numbers') .get<boolean>('motions_show_sequential_numbers')
.subscribe(shown => (this.showSequential = shown)); .subscribe(shown => (this.showSequential = shown));
@ -1418,6 +1418,21 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
} }
} }
/**
* Tries to determine the realistic CR-Mode from a given CR mode
*/
private determineCrMode(mode: ChangeRecoMode): ChangeRecoMode {
if (this.motion) {
if (mode === ChangeRecoMode.Final && this.motion.modified_final_version) {
return ChangeRecoMode.ModifiedFinal;
}
if ((mode === ChangeRecoMode.Diff || mode === ChangeRecoMode.Changed) && !this.allChangingObjects.length) {
return ChangeRecoMode.Original;
}
}
return mode;
}
/** /**
* Function to listen to notifications if the user edits this motion. * Function to listen to notifications if the user edits this motion.
* Handles the notification messages. * Handles the notification messages.