diff --git a/client/src/app/core/repositories/motions/motion-repository.service.ts b/client/src/app/core/repositories/motions/motion-repository.service.ts index a7b752ee2..0efc76d3f 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -92,6 +92,7 @@ export class MotionRepositoryService extends BaseRepository const block = this.DS.get(MotionBlock, motion.motion_block_id); const attachments = this.DS.getMany(Mediafile, motion.attachments_id); const tags = this.DS.getMany(Tag, motion.tags_id); + const parent = this.DS.get(Motion, motion.parent_id); let state: WorkflowState = null; if (workflow) { state = workflow.getStateById(motion.state_id); @@ -106,7 +107,8 @@ export class MotionRepositoryService extends BaseRepository item, block, attachments, - tags + tags, + parent ); } diff --git a/client/src/app/shared/components/projector-button/projector-button.component.scss b/client/src/app/shared/components/projector-button/projector-button.component.scss index afe39ac65..5d253055f 100644 --- a/client/src/app/shared/components/projector-button/projector-button.component.scss +++ b/client/src/app/shared/components/projector-button/projector-button.component.scss @@ -1,8 +1,4 @@ -.projectorbutton-active { - color: white !important; -} - .projectorbutton-inactive { - background-color: white; - color: grey; + background-color: white !important; + color: grey !important; } diff --git a/client/src/app/site/motions/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/components/motion-detail/motion-detail.component.html index 2c4507daf..1cf555806 100644 --- a/client/src/app/site/motions/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/components/motion-detail/motion-detail.component.html @@ -111,7 +111,20 @@ {{ motion.star ? 'star' : 'star_border' }} - Sequential number {{ motion.id }} + + + + Sequential number {{ motion.id }} + + · + + Amendment to {{ + motion.parent.identifier || motion.parent.title + }} + + + @@ -371,6 +384,14 @@ {{ motion.origin }} + +
+

Amendments

+
+ {{ amendment.identifierOrTitle }} +
+
+
diff --git a/client/src/app/site/motions/models/view-motion.ts b/client/src/app/site/motions/models/view-motion.ts index 3d36cddd4..59f5a7f58 100644 --- a/client/src/app/site/motions/models/view-motion.ts +++ b/client/src/app/site/motions/models/view-motion.ts @@ -53,6 +53,7 @@ export class ViewMotion extends BaseProjectableModel { protected _block: MotionBlock; protected _attachments: Mediafile[]; protected _tags: Tag[]; + protected _parent: Motion; public personalNote: PersonalNoteContent; /** @@ -238,6 +239,10 @@ export class ViewMotion extends BaseProjectableModel { return this._tags ? this._tags : null; } + public get parent(): Motion { + return this._parent; + } + /** * @returns the creation date as Date object */ @@ -320,7 +325,8 @@ export class ViewMotion extends BaseProjectableModel { item?: Item, block?: MotionBlock, attachments?: Mediafile[], - tags?: Tag[] + tags?: Tag[], + parent?: Motion ) { super(); this._motion = motion; @@ -333,6 +339,7 @@ export class ViewMotion extends BaseProjectableModel { this._block = block; this._attachments = attachments; this._tags = tags; + this._parent = parent; } public getTitle(): string { @@ -374,6 +381,8 @@ export class ViewMotion extends BaseProjectableModel { this.updateAttachments(update as Mediafile); } else if (update instanceof Tag) { this.updateTags(update as Tag); + } else if (update instanceof Motion && update.id !== this.id) { + this.updateParent(update as Motion); } } @@ -462,6 +471,14 @@ export class ViewMotion extends BaseProjectableModel { } } + public updateParent(update: Motion): void { + if (this.motion) { + if (this.parent_id && this.parent_id === update.id) { + this._parent = update as Motion; + } + } + } + public hasSupporters(): boolean { return !!(this.supporters && this.supporters.length > 0); } @@ -532,7 +549,8 @@ export class ViewMotion extends BaseProjectableModel { this._item, this._block, this._attachments, - this._tags + this._tags, + this._parent ); } } diff --git a/client/src/app/site/motions/services/motion-pdf.service.ts b/client/src/app/site/motions/services/motion-pdf.service.ts index f41d3b948..87397abd4 100644 --- a/client/src/app/site/motions/services/motion-pdf.service.ts +++ b/client/src/app/site/motions/services/motion-pdf.service.ts @@ -119,18 +119,21 @@ export class MotionPdfService { */ private createSubtitle(motion: ViewMotion): object { const subtitleLines = []; + const exportSequentialNumber = this.configService.instant('motions_export_sequential_number'); - // TODO: documents for motion amendments (having parents) - // - // if (motion.parent_id) { - // const parentMotion = this.motionRepo.getViewModel(motion.parent_id); - // subtitleLines.push(`${this.translate.instant('Amendment to motion')}: ${motion.identifierOrTitle}`); - // } - - if (this.configService.instant('motions_export_sequential_number')) { + if (exportSequentialNumber) { subtitleLines.push(`${this.translate.instant('Sequential number')}: ${motion.id}`); } + if (motion.parent_id) { + if (exportSequentialNumber) { + subtitleLines.push(' • '); + } + subtitleLines.push( + `${this.translate.instant('Amendment to')} ${motion.parent.identifier || motion.parent.title}` + ); + } + return { text: subtitleLines, style: 'subtitle'