Add amendment info in motion details

Alters motion detail to show amendments and to a given motion
and original motions to a given amendment.
Changes the motion PDF to show amendments.

Fixes a bug with the projection indicator
This commit is contained in:
Sean Engelhardt 2019-02-01 14:27:24 +01:00 committed by Emanuel Schütze
parent dc1e48329f
commit 01786f685c
5 changed files with 58 additions and 18 deletions

View File

@ -92,6 +92,7 @@ export class MotionRepositoryService extends BaseRepository<ViewMotion, Motion>
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<ViewMotion, Motion>
item,
block,
attachments,
tags
tags,
parent
);
}

View File

@ -1,8 +1,4 @@
.projectorbutton-active {
color: white !important;
}
.projectorbutton-inactive {
background-color: white;
color: grey;
background-color: white !important;
color: grey !important;
}

View File

@ -111,7 +111,20 @@
<mat-icon>{{ motion.star ? 'star' : 'star_border' }}</mat-icon>
</button>
</div>
<span class="main-nav-color title-font"><span translate>Sequential number</span>&nbsp;{{ motion.id }}</span>
<!-- Sequential number -->
<span class="main-nav-color title-font">
<span translate>Sequential number</span>&nbsp;{{ motion.id }}
<span *ngIf="motion.parent_id">
&#xb7;
<span>
<span translate>Amendment to</span>&nbsp;<a
[routerLink]="motion.parent.getDetailStateURL()">{{
motion.parent.identifier || motion.parent.title
}}</a>
</span>
</span>
</span>
</div>
<ng-container *ngIf="vp.isMobile; then mobileView; else desktopView"></ng-container>
@ -371,6 +384,14 @@
{{ motion.origin }}
</div>
<!-- Ammendments -->
<div *ngIf="!editMotion && amendments && amendments.length > 0">
<h4 translate>Amendments</h4>
<div *ngFor="let amendment of amendments">
<a [routerLink]="amendment.motion.getDetailStateURL()">{{ amendment.identifierOrTitle }}</a>
</div>
</div>
<!-- motion polls -->
<div *ngIf="!editMotion" class="spacer-top-20 spacer-bottom-20">
<os-motion-poll *ngFor="let poll of motion.motion.polls; let i = index" [rawPoll]="poll" [pollIndex]="i">

View File

@ -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
);
}
}

View File

@ -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'