Toggle to show all amendments in diff view
This commit is contained in:
parent
ea830f53b0
commit
25839ea709
@ -15,7 +15,7 @@ export class ViewMotionAmendedParagraph implements ViewUnifiedChange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private amendment: ViewMotion,
|
public amendment: ViewMotion,
|
||||||
private paragraphNo: number,
|
private paragraphNo: number,
|
||||||
private newText: string,
|
private newText: string,
|
||||||
private lineRange: LineRange
|
private lineRange: LineRange
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
-->
|
-->
|
||||||
</span>
|
</span>
|
||||||
<span class="status">
|
<span class="status">
|
||||||
<ng-container *ngIf="change.isRejected()">
|
<ng-container *ngIf="change.isRejected() && !isAmendment(change)">
|
||||||
– <span>{{ 'Rejected' | translate }}</span></ng-container
|
– <span>{{ 'Rejected' | translate }}</span></ng-container
|
||||||
>
|
>
|
||||||
<ng-container *ngIf="change.isAccepted() && isAmendment(change)">
|
<ng-container *ngIf="(change.isAccepted() || isAmendment(change)) && change.stateName">
|
||||||
– {{ change.stateName | translate }}</ng-container
|
– {{ change.stateName | translate }}</ng-container
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
@ -104,6 +104,15 @@
|
|||||||
>
|
>
|
||||||
<mat-icon>more_horiz</mat-icon>
|
<mat-icon>more_horiz</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
*ngIf="isAmendment(change)"
|
||||||
|
type="button"
|
||||||
|
[matMenuTriggerFor]="amendmentMenu"
|
||||||
|
[matMenuTriggerData]="{ change: change }"
|
||||||
|
>
|
||||||
|
<mat-icon>more_horiz</mat-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<a ng-if="change.type == 'amendment'" ui-sref="motions.motion.detail({id: change.original.id})"
|
<a ng-if="change.type == 'amendment'" ui-sref="motions.motion.detail({id: change.original.id})"
|
||||||
@ -114,9 +123,17 @@
|
|||||||
</a>
|
</a>
|
||||||
-->
|
-->
|
||||||
</div>
|
</div>
|
||||||
<div class="status-row" *ngIf="change.isRejected()">
|
<div class="status-row" *ngIf="isChangeRecommendation(change) && change.isRejected()">
|
||||||
<i class="grey">{{ 'Rejected' | translate }}</i>
|
<i class="grey">{{ 'Rejected' | translate }}</i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- If it's an amendment, only accepted ones will be passed to this component
|
||||||
|
by default (== !showAllAmendments). In this case, don't show the prefix.
|
||||||
|
However, if showAllAmendments === true, the prefix should be shown alwayes,
|
||||||
|
even if it's accepted -->
|
||||||
|
<div class="status-row" *ngIf="isAmendment(change) && showAllAmendments">
|
||||||
|
<i class="grey">{{ change.amendment.identifier }} - {{ change.amendment.state.name | translate }}</i>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="motion-text motion-text-diff"
|
class="motion-text motion-text-diff"
|
||||||
@ -143,12 +160,46 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<mat-menu #amendmentMenu="matMenu">
|
||||||
|
<ng-template matMenuContent let-change="change">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
mat-menu-item
|
||||||
|
[routerLink]="change.amendment.getDetailStateURL()" [state]="{ back: 'true' }"
|
||||||
|
>
|
||||||
|
<mat-icon>visibility_on</mat-icon>
|
||||||
|
<span>{{ 'Show amendment' | translate }}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<mat-divider *ngIf="change.amendment.state.next_states.length > 0"></mat-divider>
|
||||||
|
|
||||||
|
<button *ngFor="let state of change.amendment.state.next_states" mat-menu-item (click)="setAmendmentState(change, state.id)">
|
||||||
|
{{ state.name | translate }} <span *ngIf="state.show_state_extension_field"> ...</span>
|
||||||
|
</button>
|
||||||
|
<mat-divider *ngIf="change.amendment.state.next_states.length > 0"></mat-divider>
|
||||||
|
<button
|
||||||
|
*ngFor="let state of change.amendment.state.previous_states"
|
||||||
|
mat-menu-item
|
||||||
|
(click)="setAmendmentState(change, state.id)"
|
||||||
|
>
|
||||||
|
<mat-icon>arrow_back</mat-icon>
|
||||||
|
{{ state.name | translate }}
|
||||||
|
<span *ngIf="state.show_state_extension_field"> ...</span>
|
||||||
|
</button>
|
||||||
|
<button mat-menu-item (click)="setAmendmentState(change, null)">
|
||||||
|
<mat-icon>replay</mat-icon>
|
||||||
|
{{ 'Reset state' | translate }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- perms.isAllowed('change_state', motion) -->
|
||||||
|
</ng-template>
|
||||||
|
</mat-menu>
|
||||||
|
|
||||||
<mat-menu #changeRecommendationMenu="matMenu">
|
<mat-menu #changeRecommendationMenu="matMenu">
|
||||||
<ng-template matMenuContent let-change="change">
|
<ng-template matMenuContent let-change="change">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
[disabled]="hasCollissions(change, changes)"
|
|
||||||
(click)="setAcceptanceValue(change, 'accepted')"
|
(click)="setAcceptanceValue(change, 'accepted')"
|
||||||
>
|
>
|
||||||
<mat-icon>thumb_up</mat-icon>
|
<mat-icon>thumb_up</mat-icon>
|
||||||
@ -158,7 +209,6 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
[disabled]="hasCollissions(change, changes)"
|
|
||||||
(click)="setAcceptanceValue(change, 'rejected')"
|
(click)="setAcceptanceValue(change, 'rejected')"
|
||||||
>
|
>
|
||||||
<mat-icon>thumb_down</mat-icon>
|
<mat-icon>thumb_down</mat-icon>
|
||||||
|
@ -26,6 +26,7 @@ import {
|
|||||||
MotionTitleChangeRecommendationDialogComponent,
|
MotionTitleChangeRecommendationDialogComponent,
|
||||||
MotionTitleChangeRecommendationDialogComponentData
|
MotionTitleChangeRecommendationDialogComponentData
|
||||||
} from '../motion-title-change-recommendation-dialog/motion-title-change-recommendation-dialog.component';
|
} from '../motion-title-change-recommendation-dialog/motion-title-change-recommendation-dialog.component';
|
||||||
|
import { ViewMotionAmendedParagraph } from '../../../../models/view-motion-amended-paragraph';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component displays the original motion text with the change blocks inside.
|
* This component displays the original motion text with the change blocks inside.
|
||||||
@ -45,6 +46,7 @@ import {
|
|||||||
* [scrollToChange]="change"
|
* [scrollToChange]="change"
|
||||||
* [highlightedLine]="highlightedLine"
|
* [highlightedLine]="highlightedLine"
|
||||||
* [lineNumberingMode]="lnMode"
|
* [lineNumberingMode]="lnMode"
|
||||||
|
* [showAllAmendments]="showAllAmendments"
|
||||||
* (createChangeRecommendation)="createChangeRecommendation($event)"
|
* (createChangeRecommendation)="createChangeRecommendation($event)"
|
||||||
* ></os-motion-detail-diff>
|
* ></os-motion-detail-diff>
|
||||||
* ```
|
* ```
|
||||||
@ -70,6 +72,8 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
|
|||||||
public highlightedLine: number;
|
public highlightedLine: number;
|
||||||
@Input()
|
@Input()
|
||||||
public lineNumberingMode: LineNumberingMode;
|
public lineNumberingMode: LineNumberingMode;
|
||||||
|
@Input()
|
||||||
|
public showAllAmendments: boolean;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
public createChangeRecommendation: EventEmitter<LineRange> = new EventEmitter<LineRange>();
|
public createChangeRecommendation: EventEmitter<LineRange> = new EventEmitter<LineRange>();
|
||||||
@ -364,6 +368,10 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setAmendmentState(change: ViewUnifiedChange, state: number): void {
|
||||||
|
this.motionRepo.setState((change as ViewMotionAmendedParagraph).amendment, state).catch(this.raiseError);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scrolls to the native element specified by [scrollToChange]
|
* Scrolls to the native element specified by [scrollToChange]
|
||||||
*/
|
*/
|
||||||
|
@ -463,6 +463,11 @@
|
|||||||
<span *ngIf="amendments.length === 1">{{ 'Amendment' | translate }}</span>
|
<span *ngIf="amendments.length === 1">{{ 'Amendment' | translate }}</span>
|
||||||
<span *ngIf="amendments.length > 1">{{ 'Amendments' | translate }}</span>
|
<span *ngIf="amendments.length > 1">{{ 'Amendments' | translate }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<mat-checkbox [(ngModel)]="showAllAmendments" *ngIf="isRecoMode(ChangeRecoMode.Diff)">
|
||||||
|
{{ 'Temporarily show all in text' | translate }}
|
||||||
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- motion polls -->
|
<!-- motion polls -->
|
||||||
@ -681,6 +686,7 @@
|
|||||||
[changes]="getChangesForDiffMode()"
|
[changes]="getChangesForDiffMode()"
|
||||||
[scrollToChange]="scrollToChange"
|
[scrollToChange]="scrollToChange"
|
||||||
[highlightedLine]="highlightedLine"
|
[highlightedLine]="highlightedLine"
|
||||||
|
[showAllAmendments]="showAllAmendments"
|
||||||
[lineNumberingMode]="lnMode"
|
[lineNumberingMode]="lnMode"
|
||||||
(createChangeRecommendation)="createChangeRecommendation($event)"
|
(createChangeRecommendation)="createChangeRecommendation($event)"
|
||||||
></os-motion-detail-diff>
|
></os-motion-detail-diff>
|
||||||
@ -904,6 +910,7 @@
|
|||||||
[changes]="getChangesForDiffMode()"
|
[changes]="getChangesForDiffMode()"
|
||||||
[scrollToChange]="scrollToChange"
|
[scrollToChange]="scrollToChange"
|
||||||
[highlightedLine]="highlightedLine"
|
[highlightedLine]="highlightedLine"
|
||||||
|
[showAllAmendments]="showAllAmendments"
|
||||||
[lineNumberingMode]="lnMode"
|
[lineNumberingMode]="lnMode"
|
||||||
(createChangeRecommendation)="createChangeRecommendation($event)"
|
(createChangeRecommendation)="createChangeRecommendation($event)"
|
||||||
></os-motion-detail-diff>
|
></os-motion-detail-diff>
|
||||||
|
@ -327,6 +327,11 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
|
|||||||
*/
|
*/
|
||||||
private amendmentTextMode: string;
|
private amendmentTextMode: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show all amendments in the text, not only the ones with the apropriate state
|
||||||
|
*/
|
||||||
|
public showAllAmendments = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For using the enum constants from the template
|
* For using the enum constants from the template
|
||||||
*/
|
*/
|
||||||
@ -1005,7 +1010,11 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
|
|||||||
|
|
||||||
public getChangesForDiffMode(): ViewUnifiedChange[] {
|
public getChangesForDiffMode(): ViewUnifiedChange[] {
|
||||||
return this.allChangingObjects.filter(change => {
|
return this.allChangingObjects.filter(change => {
|
||||||
return change.showInDiffView();
|
if (this.showAllAmendments) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return change.showInDiffView();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user