Skip to content

Commit

Permalink
Merge branch 'main' into 4291-fix-motion-list-specific-perms
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl committed Oct 30, 2024
2 parents a89a701 + 4949799 commit c6b4120
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 19 deletions.
10 changes: 5 additions & 5 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"ngx-material-timepicker": "^13.1.1",
"ngx-papaparse": "^8.0.0",
"pdfjs-dist": "^4.6.82",
"pdfmake": "^0.2.12",
"pdfmake": "^0.2.14",
"pofile": "^1.1.4",
"qrcode": "^1.5.4",
"rxjs": "^7.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class AmendmentParagraphUnifiedChange implements ViewUnifiedChange {
public type!: number;
public merge_amendment_into_final: MergeAmendment;
public merge_amendment_into_diff: MergeAmendment;
public amend_nr: string;

public constructor(
data: AmendmentData,
Expand All @@ -23,6 +24,7 @@ export class AmendmentParagraphUnifiedChange implements ViewUnifiedChange {
this.id = data.id;
this.merge_amendment_into_final = data.merge_amendment_into_final;
this.merge_amendment_into_diff = data.merge_amendment_into_diff;
this.amend_nr = data.number;
}

public getTitle(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,24 @@
}
}
}

.amendment-nr-n-icon {
display: flex;
align-items: center;
justify-content: flex-start;
position: relative;
left: -40px;
height: 1.5em;
margin-top: 25px;
}

.amendment-nr {
position: relative;
font-style: italic;
background-color: rgb(224, 224, 224);
padding-right: 4px;
}

.os-linebreak {
display: none !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class MotionSlideComponent
return html;
}

public getAllTextChangingObjects(): ViewUnifiedChange[] {
private getAllTextChangingObjects(): ViewUnifiedChange[] {
return this.allChangingObjects.filter((obj: ViewUnifiedChange) => !obj.isTitleChange());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Id } from 'src/app/domain/definitions/key-types';
import { MotionFormattingRepresentation } from 'src/app/domain/models/motions/motion';
import { ChangeRecoMode } from 'src/app/domain/models/motions/motions.constants';
import { ChangeRecoMode, LineNumberingMode } from 'src/app/domain/models/motions/motions.constants';
import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service';

import { ViewUnifiedChange, ViewUnifiedChangeType } from '../../../modules';
Expand Down Expand Up @@ -68,7 +69,8 @@ export class MotionFormatService {
private diffService: MotionDiffService,
private amendmentController: AmendmentControllerService,
private changeRecoRepo: MotionChangeRecommendationControllerService,
private settings: MeetingSettingsService
private settings: MeetingSettingsService,
private translate: TranslateService
) {}

/**
Expand Down Expand Up @@ -215,7 +217,7 @@ export class MotionFormatService {

private getDiffView = (targetMotion: MotionFormattingRepresentation, args: DifferedViewArguments): string => {
const { changes, lineLength, highlightedLine, firstLine }: DifferedViewArguments = args;
const text = [];
const text: string[] = [];
const changesToShow = changes.filter(change => change.showInDiffView());
const motionText = this.lineNumberingService.insertLineNumbers({
html: targetMotion.text,
Expand All @@ -239,14 +241,71 @@ export class MotionFormatService {
)
);
}

text.push(this.addAmendmentNr(changesToShow, changesToShow[i]));
text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine));
lastLineTo = changesToShow[i].getLineTo();
}

text.push(
this.diffService.getTextRemainderAfterLastChange(motionText, changesToShow, lineLength, highlightedLine)
);
return text.join(``);
return this.adjustDiffClasses(text).join(``);
};

private addAmendmentNr(changesToShow: ViewUnifiedChange[], current_text: ViewUnifiedChange): string {
const lineNumbering = this.settings.instant(`motions_default_line_numbering`);
const amendmentNr: string[] = [];

if (this.diffService.changeHasCollissions(current_text, changesToShow)) {
if (lineNumbering === LineNumberingMode.Outside) {
amendmentNr.push(
`<span class="amendment-nr-n-icon"><mat-icon class="margin-right-10">warning</mat-icon>`
);
} else if (lineNumbering === LineNumberingMode.Inside) {
amendmentNr.push(
`<span class="amendment-nr-n-icon"><mat-icon class="margin-left-45">warning</mat-icon>`
);
} else {
amendmentNr.push(
`<span class="amendment-nr-n-icon"><mat-icon class="margin-left-40">warning</mat-icon>`
);
}
} else {
if (lineNumbering === LineNumberingMode.Outside) {
amendmentNr.push(`<span class="amendment-nr-n-icon">`);
} else if (lineNumbering === LineNumberingMode.Inside) {
amendmentNr.push(`<span class="margin-left-46 amendment-nr-n-icon">`);
} else {
amendmentNr.push(`<span class="margin-left-40 amendment-nr-n-icon">`);
}
}
amendmentNr.push(`<span class="amendment-nr">`);
if (`amend_nr` in current_text) {
if (typeof current_text.amend_nr === `string`) {
amendmentNr.push(current_text.amend_nr);
}
if (current_text.amend_nr === ``) {
amendmentNr.push(this.translate.instant(`Amendment`));
}
} else {
amendmentNr.push(this.translate.instant(`Change recommendation`));
}
amendmentNr.push(`: </span></span>`);
return amendmentNr.join(``);
}

private adjustDiffClasses(text: string[]): string[] {
for (let i = 0; i < text.length; i++) {
// Removes the unwanted gap between the paragraph and the amendment number
if (text[i]?.indexOf(`amendment-nr-n-icon`) !== -1) {
text[i + 1] = text[i + 1]?.replace(`os-split-after`, `os-split-after margin-top-0`);
text[i + 1] = text[i + 1]?.replace(`<p>`, `<p class="margin-top-0">`);
}

if (text[i]?.search(`<os-linebreak`) > -1) {
text[i] = text[i].replace(/ class="os-line-number line-number-[1-9]+"/, ``);
}
}
return text;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ <h2>{{ 'Committees and meetings' | translate }}</h2>
@for (row of tableData | keyvalue: tableDataAscOrderCompare; track row; let lastLine = $last) {
<!-- Handle committees without meetings-->
@if (!getNumberOfKeys(row.value.meetings)) {
<tr [ngClass]="getCellClass(true, true, lastLine)">
<tr class="word-break" [ngClass]="getCellClass(true, true, lastLine)">
<td>
<a [routerLink]="'/committees/' + row.key + ''">{{ row.value.committee_name }}</a>
</td>
Expand All @@ -184,7 +184,7 @@ <h2>{{ 'Committees and meetings' | translate }}</h2>
let isFirst = $first;
let isLast = $last
) {
<tr [ngClass]="getCellClass(true, true, lastLine)">
<tr class="word-break" [ngClass]="getCellClass(true, true, lastLine)">
@if (isFirst) {
<td [attr.rowspan]="getNumberOfKeys(row.value.meetings)">
<a [routerLink]="'/committees/' + row.key + ''">
Expand All @@ -204,12 +204,12 @@ <h2>{{ 'Committees and meetings' | translate }}</h2>
}
</td>
}
<td [ngClass]="getCellClass(false, isLast, lastLine)">
<td class="word-break" [ngClass]="getCellClass(false, isLast, lastLine)">
<a [routerLink]="'/' + meeting_row.key + ''">
{{ meeting_row.value.meeting_name }}
</a>
</td>
<td [ngClass]="getCellClass(false, isLast, lastLine)">
<td class="word-break" [ngClass]="getCellClass(false, isLast, lastLine)">
@for (group of meeting_row.value.group_names; track group; let lastGroup = $last) {
<span>{{ group }}{{ !lastGroup ? ', ' : '' }}</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ os-user-detail-view h2 {
.committee-underline {
border-bottom: 1px solid rgba(153, 153, 153, 0.5);
}

.word-break {
word-break: break-word;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const MSOfficePaste = Extension.create({
const OfficePastePlugin = new Plugin({
props: {
transformPastedHTML(html: string): string {
console.log([html]);
console.debug([html]);
if (html.indexOf(`microsoft-com`) !== -1 && html.indexOf(`office`) !== -1) {
html = transformLists(html);
html = transformRemoveBookmarks(html);
html = transformMsoStyles(html);
}
console.log([html]);
console.debug([html]);
return html;
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/meta
Submodule meta updated 1 files
+10 −10 models.yml

0 comments on commit c6b4120

Please sign in to comment.