Skip to content

Commit

Permalink
Fix amendment display (#2819)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisa-beerboom authored Sep 18, 2023
1 parent 74bc83f commit 2a258a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export abstract class BaseMotionDetailChildComponent extends BaseMeetingComponen
if (!Object.keys(previousMotion || {}).length && Object.keys(motion).length) {
this.onInitTextBasedAmendment(); // Assuming that it's an amendment
}

this.onAfterSetMotion(previousMotion, motion);
}

public get motion(): ViewMotion {
Expand Down Expand Up @@ -206,6 +208,11 @@ export abstract class BaseMotionDetailChildComponent extends BaseMeetingComponen
*/
protected onInitTextBasedAmendment(): void {}

/**
* Function called after all eventual updates whenever the motion setter is called
*/
protected onAfterSetMotion(_previous: ViewMotion, _current: ViewMotion): void {}

/**
* Function called when a new motion is passed and right after the internal `init`-function was called
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MatMenuTrigger } from '@angular/material/menu';
import { TranslateService } from '@ngx-translate/core';
import { Subscription } from 'rxjs';
import { ChangeRecoMode, LineNumberingMode } from 'src/app/domain/models/motions/motions.constants';
import { ViewMotionChangeRecommendation } from 'src/app/site/pages/meetings/pages/motions';
import { ViewMotion, ViewMotionChangeRecommendation } from 'src/app/site/pages/meetings/pages/motions';
import { MeetingComponentServiceCollectorService } from 'src/app/site/pages/meetings/services/meeting-component-service-collector.service';
import { ViewPortService } from 'src/app/site/services/view-port.service';
import { PromptService } from 'src/app/ui/modules/prompt-dialog';
Expand Down Expand Up @@ -154,7 +154,7 @@ export class MotionHighlightFormComponent extends BaseMotionDetailChildComponent
let target: Element | null;
// to make the selected line not stick at the very top of the screen, and to prevent it from being
// conceiled from the header, we actually scroll to a element a little bit above.
if (line > 4) {
if ((line as number) > 4) {
target = element.querySelector(`.os-line-number.line-number-` + ((line as number) - 4).toString(10));
} else {
target = element.querySelector(`.title-line`);
Expand Down Expand Up @@ -266,6 +266,15 @@ export class MotionHighlightFormComponent extends BaseMotionDetailChildComponent
this.startLineNumber = this.motion?.start_line_number || 1;
}

protected override onAfterSetMotion(previous: ViewMotion, current: ViewMotion): void {
if (!previous?.amendment_paragraphs && !!current?.amendment_paragraphs) {
const recoMode = this.meetingSettingsService.instant(`motions_recommendation_text_mode`);
if (recoMode) {
this.setChangeRecoMode(this.determineCrMode(recoMode as ChangeRecoMode));
}
}
}

/**
* Tries to determine the realistic CR-Mode from a given CR mode
*/
Expand Down

0 comments on commit 2a258a3

Please sign in to comment.