Merge pull request #4287 from CatoTH/Openslides3-Bugfix-LineNumbering-Switching

Bugfix: pass line numbering mode to motion-detail-diff
This commit is contained in:
Emanuel Schütze 2019-02-10 11:49:21 +01:00 committed by GitHub
commit 3e7d23a283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 12 deletions

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { E2EImportsModule } from '../../../../../e2e-imports.module'; import { E2EImportsModule } from '../../../../../e2e-imports.module';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ViewMotion } from '../../models/view-motion'; import { LineNumberingMode, ViewMotion } from '../../models/view-motion';
import { MotionDetailDiffComponent } from './motion-detail-diff.component'; import { MotionDetailDiffComponent } from './motion-detail-diff.component';
import { MotionDetailOriginalChangeRecommendationsComponent } from '../motion-detail-original-change-recommendations/motion-detail-original-change-recommendations.component'; import { MotionDetailOriginalChangeRecommendationsComponent } from '../motion-detail-original-change-recommendations/motion-detail-original-change-recommendations.component';
import { ViewUnifiedChange } from '../../models/view-unified-change'; import { ViewUnifiedChange } from '../../models/view-unified-change';
@ -16,6 +16,7 @@ import { ViewMotionChangeRecommendation } from '../../models/view-change-recomme
[changes]="changes" [changes]="changes"
[highlightedLine]="highlightedLine" [highlightedLine]="highlightedLine"
[scrollToChange]="scrollToChange" [scrollToChange]="scrollToChange"
[lineNumberingMode]="lnMode"
(createChangeRecommendation)="createChangeRecommendation($event)" (createChangeRecommendation)="createChangeRecommendation($event)"
> >
</os-motion-detail-diff> </os-motion-detail-diff>
@ -24,6 +25,7 @@ import { ViewMotionChangeRecommendation } from '../../models/view-change-recomme
class TestHostComponent { class TestHostComponent {
public motion: ViewMotion; public motion: ViewMotion;
public changes: ViewMotionChangeRecommendation[]; public changes: ViewMotionChangeRecommendation[];
public lnMode: LineNumberingMode = LineNumberingMode.Outside;
public scrollToChange: ViewUnifiedChange = null; public scrollToChange: ViewUnifiedChange = null;
public constructor() { public constructor() {

View File

@ -33,6 +33,7 @@ import { ConfigService } from 'app/core/ui-services/config.service';
* [changes]="changes" * [changes]="changes"
* [scrollToChange]="change" * [scrollToChange]="change"
* [highlightedLine]="highlightedLine" * [highlightedLine]="highlightedLine"
* [lineNumberingMode]="lnMode"
* (createChangeRecommendation)="createChangeRecommendation($event)" * (createChangeRecommendation)="createChangeRecommendation($event)"
* ></os-motion-detail-diff> * ></os-motion-detail-diff>
* ``` * ```
@ -51,15 +52,12 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
public scrollToChange: ViewUnifiedChange; public scrollToChange: ViewUnifiedChange;
@Input() @Input()
public highlightedLine: number; public highlightedLine: number;
@Input()
public lineNumberingMode: LineNumberingMode;
@Output() @Output()
public createChangeRecommendation: EventEmitter<LineRange> = new EventEmitter<LineRange>(); public createChangeRecommendation: EventEmitter<LineRange> = new EventEmitter<LineRange>();
/**
* Indicates the LineNumberingMode Mode.
*/
public lnMode: LineNumberingMode;
/** /**
* Indicates the maximum line length as defined in the configuration. * Indicates the maximum line length as defined in the configuration.
*/ */
@ -89,9 +87,6 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
) { ) {
super(title, translate, matSnackBar); super(title, translate, matSnackBar);
this.configService
.get<LineNumberingMode>('motions_default_line_numbering')
.subscribe(mode => (this.lnMode = mode));
this.configService.get<number>('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength)); this.configService.get<number>('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength));
} }
@ -181,7 +176,7 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
* @returns whether there are line numbers at all * @returns whether there are line numbers at all
*/ */
public isLineNumberingNone(): boolean { public isLineNumberingNone(): boolean {
return this.lnMode === LineNumberingMode.None; return this.lineNumberingMode === LineNumberingMode.None;
} }
/** /**
@ -190,7 +185,7 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
* @returns whether the line numberings are inside * @returns whether the line numberings are inside
*/ */
public isLineNumberingInline(): boolean { public isLineNumberingInline(): boolean {
return this.lnMode === LineNumberingMode.Inside; return this.lineNumberingMode === LineNumberingMode.Inside;
} }
/** /**
@ -199,7 +194,7 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
* @returns whether the line numberings are outside * @returns whether the line numberings are outside
*/ */
public isLineNumberingOutside(): boolean { public isLineNumberingOutside(): boolean {
return this.lnMode === LineNumberingMode.Outside; return this.lineNumberingMode === LineNumberingMode.Outside;
} }
/** /**

View File

@ -595,6 +595,7 @@
[changes]="allChangingObjects" [changes]="allChangingObjects"
[scrollToChange]="scrollToChange" [scrollToChange]="scrollToChange"
[highlightedLine]="highlightedLine" [highlightedLine]="highlightedLine"
[lineNumberingMode]="lnMode"
(createChangeRecommendation)="createChangeRecommendation($event)" (createChangeRecommendation)="createChangeRecommendation($event)"
></os-motion-detail-diff> ></os-motion-detail-diff>
</ng-container> </ng-container>