From 2abe71313c6b0c608a2131565576e124a291c287 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 21 Feb 2019 12:34:13 +0100 Subject: [PATCH] Motion block slide --- .../motion-block-list.component.html | 8 ++++ .../motion-block-list.component.ts | 6 ++- .../motion-detail/motion-detail.component.ts | 15 +------ .../site/motions/models/view-motion-block.ts | 11 ++++- .../app/site/motions/models/view-workflow.ts | 7 ++++ .../app/slides/all-slide-configurations.ts | 5 +++ client/src/app/slides/all-slides.ts | 10 ++++- .../motion-block/motion-block-slide-data.ts | 14 +++++++ .../motion-block-slide.component.html | 10 +++++ .../motion-block-slide.component.scss | 0 .../motion-block-slide.component.spec.ts | 26 ++++++++++++ .../motion-block-slide.component.ts | 35 ++++++++++++++++ .../motion-block-slide.module.spec.ts | 13 ++++++ .../motion-block/motion-block-slide.module.ts | 7 ++++ ...ion-slide-data.ts => motion-slide-data.ts} | 18 ++++----- ...> motion-slide-obj-amendment-paragraph.ts} | 6 +-- ...eco.ts => motion-slide-obj-change-reco.ts} | 6 +-- ...onent.html => motion-slide.component.html} | 0 ...onent.scss => motion-slide.component.scss} | 0 ...spec.ts => motion-slide.component.spec.ts} | 10 ++--- ...component.ts => motion-slide.component.ts} | 36 ++++++++--------- .../motion/motion-slide.module.spec.ts | 13 ++++++ .../motions/motion/motion-slide.module.ts | 7 ++++ .../motions-motion-slide.module.spec.ts | 13 ------ .../motion/motions-motion-slide.module.ts | 7 ---- openslides/motions/projector.py | 40 ++++++++++++++++++- 26 files changed, 246 insertions(+), 77 deletions(-) create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide-data.ts create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide.component.html create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide.component.scss create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide.component.spec.ts create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide.component.ts create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide.module.spec.ts create mode 100644 client/src/app/slides/motions/motion-block/motion-block-slide.module.ts rename client/src/app/slides/motions/motion/{motions-motion-slide-data.ts => motion-slide-data.ts} (81%) rename client/src/app/slides/motions/motion/{motions-motion-slide-obj-amendment-paragraph.ts => motion-slide-obj-amendment-paragraph.ts} (87%) rename client/src/app/slides/motions/motion/{motions-motion-slide-obj-change-reco.ts => motion-slide-obj-change-reco.ts} (82%) rename client/src/app/slides/motions/motion/{motions-motion-slide.component.html => motion-slide.component.html} (100%) rename client/src/app/slides/motions/motion/{motions-motion-slide.component.scss => motion-slide.component.scss} (100%) rename client/src/app/slides/motions/motion/{motions-motion-slide.component.spec.ts => motion-slide.component.spec.ts} (62%) rename client/src/app/slides/motions/motion/{motions-motion-slide.component.ts => motion-slide.component.ts} (89%) create mode 100644 client/src/app/slides/motions/motion/motion-slide.module.spec.ts create mode 100644 client/src/app/slides/motions/motion/motion-slide.module.ts delete mode 100644 client/src/app/slides/motions/motion/motions-motion-slide.module.spec.ts delete mode 100644 client/src/app/slides/motions/motion/motions-motion-slide.module.ts diff --git a/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.html b/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.html index 4d190da3e..e168f6e4a 100644 --- a/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.html +++ b/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.html @@ -52,6 +52,14 @@ + + + Projector + + + + + Title diff --git a/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.ts b/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.ts index e46913132..5da2cf866 100644 --- a/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.ts +++ b/client/src/app/site/motions/components/motion-block-list/motion-block-list.component.ts @@ -122,7 +122,11 @@ export class MotionBlockListComponent extends ListViewBaseComponent ({ + name: MotionBlock.COLLECTIONSTRING, + id: this.id, + getIdentifiers: () => ['name', 'id'] + }), + slideOptions: [], + projectionDefaultName: 'motionBlocks', + getDialogTitle: () => this.getTitle() + }; } } diff --git a/client/src/app/site/motions/models/view-workflow.ts b/client/src/app/site/motions/models/view-workflow.ts index 9e0d7a306..1e138c74b 100644 --- a/client/src/app/site/motions/models/view-workflow.ts +++ b/client/src/app/site/motions/models/view-workflow.ts @@ -2,6 +2,13 @@ import { Workflow } from 'app/shared/models/motions/workflow'; import { WorkflowState } from 'app/shared/models/motions/workflow-state'; import { BaseViewModel } from '../../base/base-view-model'; +export const StateCssClassMapping = { + success: 'green', + danger: 'red', + default: 'grey', + primary: 'lightblue' +}; + /** * class for the ViewWorkflow. * @ignore diff --git a/client/src/app/slides/all-slide-configurations.ts b/client/src/app/slides/all-slide-configurations.ts index ea31ee9ea..71abebb11 100644 --- a/client/src/app/slides/all-slide-configurations.ts +++ b/client/src/app/slides/all-slide-configurations.ts @@ -15,6 +15,11 @@ export const allSlidesDynamicConfiguration: (SlideDynamicConfiguration & Slide)[ scaleable: true, scrollable: true }, + { + slide: 'motions/motion-block', + scaleable: true, + scrollable: true + }, { slide: 'users/user', scaleable: true, diff --git a/client/src/app/slides/all-slides.ts b/client/src/app/slides/all-slides.ts index a4a699d6e..f965dbad7 100644 --- a/client/src/app/slides/all-slides.ts +++ b/client/src/app/slides/all-slides.ts @@ -19,11 +19,19 @@ export const allSlides: SlideManifest[] = [ { slide: 'motions/motion', path: 'motions/motion', - loadChildren: './slides/motions/motion/motions-motion-slide.module#MotionsMotionSlideModule', + loadChildren: './slides/motions/motion/motion-slide.module#MotionSlideModule', verboseName: 'Motion', elementIdentifiers: ['name', 'id'], canBeMappedToModel: true }, + { + slide: 'motions/motion-block', + path: 'motions/motion-block', + loadChildren: './slides/motions/motion-block/motion-block-slide.module#MotionBlockSlideModule', + verboseName: 'Motion block', + elementIdentifiers: ['name', 'id'], + canBeMappedToModel: true + }, { slide: 'users/user', path: 'users/user', diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide-data.ts b/client/src/app/slides/motions/motion-block/motion-block-slide-data.ts new file mode 100644 index 000000000..e27d0a6b7 --- /dev/null +++ b/client/src/app/slides/motions/motion-block/motion-block-slide-data.ts @@ -0,0 +1,14 @@ +export interface MotionBlockSlideMotionRepresentation { + title: string; + identifier?: string; + recommendation?: { + name: string; + css_class: string; + }; + recommendation_extension?: string; +} + +export interface MotionBlockSlideData { + title: string; + motions: MotionBlockSlideMotionRepresentation[]; +} diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide.component.html b/client/src/app/slides/motions/motion-block/motion-block-slide.component.html new file mode 100644 index 000000000..da0370bb4 --- /dev/null +++ b/client/src/app/slides/motions/motion-block/motion-block-slide.component.html @@ -0,0 +1,10 @@ +
+

{{ data.data.title }}

+ +
+ {{ getMotionTitle(motion) }} + + {{ getStateLabel(motion) }} + +
+
diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide.component.scss b/client/src/app/slides/motions/motion-block/motion-block-slide.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide.component.spec.ts b/client/src/app/slides/motions/motion-block/motion-block-slide.component.spec.ts new file mode 100644 index 000000000..af610ae63 --- /dev/null +++ b/client/src/app/slides/motions/motion-block/motion-block-slide.component.spec.ts @@ -0,0 +1,26 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MotionBlockSlideComponent } from './motion-block-slide.component'; +import { E2EImportsModule } from '../../../../e2e-imports.module'; + +describe('MotionBlockSlideComponent', () => { + let component: MotionBlockSlideComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [E2EImportsModule], + declarations: [MotionBlockSlideComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MotionBlockSlideComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide.component.ts b/client/src/app/slides/motions/motion-block/motion-block-slide.component.ts new file mode 100644 index 000000000..8c228fb4f --- /dev/null +++ b/client/src/app/slides/motions/motion-block/motion-block-slide.component.ts @@ -0,0 +1,35 @@ +import { Component } from '@angular/core'; + +import { BaseSlideComponent } from 'app/slides/base-slide-component'; +import { MotionBlockSlideData, MotionBlockSlideMotionRepresentation } from './motion-block-slide-data'; +import { Motion } from 'app/shared/models/motions/motion'; +import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service'; +import { StateCssClassMapping } from 'app/site/motions/models/view-workflow'; +import { TranslateService } from '@ngx-translate/core'; + +@Component({ + selector: 'os-motion-block-slide', + templateUrl: './motion-block-slide.component.html', + styleUrls: ['./motion-block-slide.component.scss'] +}) +export class MotionBlockSlideComponent extends BaseSlideComponent { + public constructor(private motionRepo: MotionRepositoryService, private translate: TranslateService) { + super(); + } + + public getMotionTitle(motion: Partial): string { + return this.motionRepo.getAgendaTitle(motion); + } + + public getStateCssColor(motion: MotionBlockSlideMotionRepresentation): string { + return StateCssClassMapping[motion.recommendation.css_class] || ''; + } + + public getStateLabel(motion: MotionBlockSlideMotionRepresentation): string { + let recommendation = this.translate.instant(motion.recommendation.name); + if (motion.recommendation_extension) { + recommendation += ' ' + motion.recommendation_extension; + } + return recommendation; + } +} diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide.module.spec.ts b/client/src/app/slides/motions/motion-block/motion-block-slide.module.spec.ts new file mode 100644 index 000000000..6f61508ea --- /dev/null +++ b/client/src/app/slides/motions/motion-block/motion-block-slide.module.spec.ts @@ -0,0 +1,13 @@ +import { MotionBlockSlideModule } from './motion-block-slide.module'; + +describe('MotionBlockSlideModule', () => { + let motionBlockSlideModule: MotionBlockSlideModule; + + beforeEach(() => { + motionBlockSlideModule = new MotionBlockSlideModule(); + }); + + it('should create an instance', () => { + expect(motionBlockSlideModule).toBeTruthy(); + }); +}); diff --git a/client/src/app/slides/motions/motion-block/motion-block-slide.module.ts b/client/src/app/slides/motions/motion-block/motion-block-slide.module.ts new file mode 100644 index 000000000..7722719fa --- /dev/null +++ b/client/src/app/slides/motions/motion-block/motion-block-slide.module.ts @@ -0,0 +1,7 @@ +import { NgModule } from '@angular/core'; + +import { makeSlideModule } from 'app/slides/base-slide-module'; +import { MotionBlockSlideComponent } from './motion-block-slide.component'; + +@NgModule(makeSlideModule(MotionBlockSlideComponent)) +export class MotionBlockSlideModule {} diff --git a/client/src/app/slides/motions/motion/motions-motion-slide-data.ts b/client/src/app/slides/motions/motion/motion-slide-data.ts similarity index 81% rename from client/src/app/slides/motions/motion/motions-motion-slide-data.ts rename to client/src/app/slides/motions/motion/motion-slide-data.ts index 5838b0cad..f0f50d45e 100644 --- a/client/src/app/slides/motions/motion/motions-motion-slide-data.ts +++ b/client/src/app/slides/motions/motion/motion-slide-data.ts @@ -5,7 +5,7 @@ import { MergeAmendment } from '../../../shared/models/motions/workflow-state'; * This interface describes the data returned by the server about an amendment. * This object is used if actually the motion is shown and the amendment is shown in the context of the motion. */ -export interface MotionsMotionSlideDataAmendment { +export interface MotionSlideDataAmendment { id: number; title: string; amendment_paragraphs: string[]; @@ -16,7 +16,7 @@ export interface MotionsMotionSlideDataAmendment { * This interface describes the data returned by the server about a motion that is changed by an amendment. * It only contains the data necessary for rendering the amendment's diff. */ -export interface MotionsMotionSlideDataBaseMotion { +export interface MotionSlideDataBaseMotion { identifier: string; title: string; text: string; @@ -26,7 +26,7 @@ export interface MotionsMotionSlideDataBaseMotion { * This interface describes the data returned by the server about a statute paragraph that is changed by an amendment. * It only contains the data necessary for rendering the amendment's diff. */ -export interface MotionsMotionSlideDataBaseStatute { +export interface MotionSlideDataBaseStatute { title: string; text: string; } @@ -34,7 +34,7 @@ export interface MotionsMotionSlideDataBaseStatute { /** * This interface describes the data returned by the server about a change recommendation. */ -export interface MotionsMotionSlideDataChangeReco { +export interface MotionSlideDataChangeReco { creation_time: string; id: number; internal: boolean; @@ -53,7 +53,7 @@ export interface MotionsMotionSlideDataChangeReco { * This interface describes either an motion (with all amendments and change recommendations enbedded) * or an amendment (with the bas motion embedded). */ -export interface MotionsMotionSlideData { +export interface MotionSlideData { identifier: string; title: string; preamble: string; @@ -65,11 +65,11 @@ export interface MotionsMotionSlideData { recommender?: string; recommendation?: string; recommendation_extension?: string; - base_motion?: MotionsMotionSlideDataBaseMotion; - base_statute?: MotionsMotionSlideDataBaseStatute; + base_motion?: MotionSlideDataBaseMotion; + base_statute?: MotionSlideDataBaseStatute; amendment_paragraphs: string[]; - change_recommendations: MotionsMotionSlideDataChangeReco[]; - amendments: MotionsMotionSlideDataAmendment[]; + change_recommendations: MotionSlideDataChangeReco[]; + amendments: MotionSlideDataAmendment[]; modified_final_version?: string; line_length: number; line_numbering_mode: LineNumberingMode; diff --git a/client/src/app/slides/motions/motion/motions-motion-slide-obj-amendment-paragraph.ts b/client/src/app/slides/motions/motion/motion-slide-obj-amendment-paragraph.ts similarity index 87% rename from client/src/app/slides/motions/motion/motions-motion-slide-obj-amendment-paragraph.ts rename to client/src/app/slides/motions/motion/motion-slide-obj-amendment-paragraph.ts index eda5acdd7..7845a6059 100644 --- a/client/src/app/slides/motions/motion/motions-motion-slide-obj-amendment-paragraph.ts +++ b/client/src/app/slides/motions/motion/motion-slide-obj-amendment-paragraph.ts @@ -1,5 +1,5 @@ import { ViewUnifiedChange, ViewUnifiedChangeType } from '../../../shared/models/motions/view-unified-change'; -import { MotionsMotionSlideDataAmendment } from './motions-motion-slide-data'; +import { MotionSlideDataAmendment } from './motion-slide-data'; import { MergeAmendment } from '../../../shared/models/motions/workflow-state'; import { LineRange } from '../../../core/ui-services/diff.service'; @@ -7,13 +7,13 @@ import { LineRange } from '../../../core/ui-services/diff.service'; * This class adds methods to the MotionsMotionSlideDataChangeReco data object * necessary for use it as a UnifiedChange in the Diff-Functions */ -export class MotionsMotionSlideObjAmendmentParagraph implements ViewUnifiedChange { +export class MotionSlideObjAmendmentParagraph implements ViewUnifiedChange { public id: number; public type: number; public merge_amendment_into_final: MergeAmendment; public constructor( - data: MotionsMotionSlideDataAmendment, + data: MotionSlideDataAmendment, private paragraphNo: number, private newText: string, private lineRange: LineRange diff --git a/client/src/app/slides/motions/motion/motions-motion-slide-obj-change-reco.ts b/client/src/app/slides/motions/motion/motion-slide-obj-change-reco.ts similarity index 82% rename from client/src/app/slides/motions/motion/motions-motion-slide-obj-change-reco.ts rename to client/src/app/slides/motions/motion/motion-slide-obj-change-reco.ts index 1247cd12f..a78d7476b 100644 --- a/client/src/app/slides/motions/motion/motions-motion-slide-obj-change-reco.ts +++ b/client/src/app/slides/motions/motion/motion-slide-obj-change-reco.ts @@ -1,11 +1,11 @@ import { ViewUnifiedChange, ViewUnifiedChangeType } from '../../../shared/models/motions/view-unified-change'; -import { MotionsMotionSlideDataChangeReco } from './motions-motion-slide-data'; +import { MotionSlideDataChangeReco } from './motion-slide-data'; /** * This class adds methods to the MotionsMotionSlideDataChangeReco data object * necessary for use it as a UnifiedChange in the Diff-Functions */ -export class MotionsMotionSlideObjChangeReco implements MotionsMotionSlideDataChangeReco, ViewUnifiedChange { +export class MotionSlideObjChangeReco implements MotionSlideDataChangeReco, ViewUnifiedChange { public creation_time: string; public id: number; public internal: boolean; @@ -17,7 +17,7 @@ export class MotionsMotionSlideObjChangeReco implements MotionsMotionSlideDataCh public text: string; public type: number; - public constructor(data: MotionsMotionSlideDataChangeReco) { + public constructor(data: MotionSlideDataChangeReco) { Object.assign(this, data); } diff --git a/client/src/app/slides/motions/motion/motions-motion-slide.component.html b/client/src/app/slides/motions/motion/motion-slide.component.html similarity index 100% rename from client/src/app/slides/motions/motion/motions-motion-slide.component.html rename to client/src/app/slides/motions/motion/motion-slide.component.html diff --git a/client/src/app/slides/motions/motion/motions-motion-slide.component.scss b/client/src/app/slides/motions/motion/motion-slide.component.scss similarity index 100% rename from client/src/app/slides/motions/motion/motions-motion-slide.component.scss rename to client/src/app/slides/motions/motion/motion-slide.component.scss diff --git a/client/src/app/slides/motions/motion/motions-motion-slide.component.spec.ts b/client/src/app/slides/motions/motion/motion-slide.component.spec.ts similarity index 62% rename from client/src/app/slides/motions/motion/motions-motion-slide.component.spec.ts rename to client/src/app/slides/motions/motion/motion-slide.component.spec.ts index e1f4e7122..55ee887fa 100644 --- a/client/src/app/slides/motions/motion/motions-motion-slide.component.spec.ts +++ b/client/src/app/slides/motions/motion/motion-slide.component.spec.ts @@ -1,21 +1,21 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { MotionsMotionSlideComponent } from './motions-motion-slide.component'; +import { MotionSlideComponent } from './motion-slide.component'; import { E2EImportsModule } from '../../../../e2e-imports.module'; describe('MotionsMotionSlideComponent', () => { - let component: MotionsMotionSlideComponent; - let fixture: ComponentFixture; + let component: MotionSlideComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [E2EImportsModule], - declarations: [MotionsMotionSlideComponent] + declarations: [MotionSlideComponent] }).compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(MotionsMotionSlideComponent); + fixture = TestBed.createComponent(MotionSlideComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/client/src/app/slides/motions/motion/motions-motion-slide.component.ts b/client/src/app/slides/motions/motion/motion-slide.component.ts similarity index 89% rename from client/src/app/slides/motions/motion/motions-motion-slide.component.ts rename to client/src/app/slides/motions/motion/motion-slide.component.ts index 6f089f6b2..de3821783 100644 --- a/client/src/app/slides/motions/motion/motions-motion-slide.component.ts +++ b/client/src/app/slides/motions/motion/motion-slide.component.ts @@ -2,21 +2,21 @@ import { Component, Input } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { BaseSlideComponent } from 'app/slides/base-slide-component'; -import { MotionsMotionSlideData, MotionsMotionSlideDataAmendment } from './motions-motion-slide-data'; +import { MotionSlideData, MotionSlideDataAmendment } from './motion-slide-data'; import { ChangeRecoMode, LineNumberingMode } from '../../../site/motions/models/view-motion'; import { DiffLinesInParagraph, DiffService, LineRange } from '../../../core/ui-services/diff.service'; import { LinenumberingService } from '../../../core/ui-services/linenumbering.service'; import { ViewUnifiedChange } from '../../../shared/models/motions/view-unified-change'; -import { MotionsMotionSlideObjChangeReco } from './motions-motion-slide-obj-change-reco'; +import { MotionSlideObjChangeReco } from './motion-slide-obj-change-reco'; import { SlideData } from '../../../site/projector/services/projector-data.service'; -import { MotionsMotionSlideObjAmendmentParagraph } from './motions-motion-slide-obj-amendment-paragraph'; +import { MotionSlideObjAmendmentParagraph } from './motion-slide-obj-amendment-paragraph'; @Component({ - selector: 'os-motions-motion-slide', - templateUrl: './motions-motion-slide.component.html', - styleUrls: ['./motions-motion-slide.component.scss'] + selector: 'os-motion-slide', + templateUrl: './motion-slide.component.html', + styleUrls: ['./motion-slide.component.scss'] }) -export class MotionsMotionSlideComponent extends BaseSlideComponent { +export class MotionSlideComponent extends BaseSlideComponent { /** * Indicates the LineNumberingMode Mode. */ @@ -48,10 +48,10 @@ export class MotionsMotionSlideComponent extends BaseSlideComponent; + private _data: SlideData; @Input() - public set data(value: SlideData) { + public set data(value: SlideData) { this._data = value; this.lnMode = value.data.line_numbering_mode; this.lineLength = value.data.line_length; @@ -62,7 +62,7 @@ export class MotionsMotionSlideComponent extends BaseSlideComponent { + public get data(): SlideData { return this._data; } @@ -77,19 +77,17 @@ export class MotionsMotionSlideComponent extends BaseSlideComponent { + (newText: string, paraNo: number): MotionSlideObjAmendmentParagraph => { if (newText === null) { return null; } @@ -114,10 +112,10 @@ export class MotionsMotionSlideComponent extends BaseSlideComponent para !== null); + .filter((para: MotionSlideObjAmendmentParagraph) => para !== null); } /** @@ -129,7 +127,7 @@ export class MotionsMotionSlideComponent extends BaseSlideComponent { - this.allChangingObjects.push(new MotionsMotionSlideObjChangeReco(change)); + this.allChangingObjects.push(new MotionSlideObjChangeReco(change)); }); } if (this.data.data.amendments) { diff --git a/client/src/app/slides/motions/motion/motion-slide.module.spec.ts b/client/src/app/slides/motions/motion/motion-slide.module.spec.ts new file mode 100644 index 000000000..cdf649f4c --- /dev/null +++ b/client/src/app/slides/motions/motion/motion-slide.module.spec.ts @@ -0,0 +1,13 @@ +import { MotionSlideModule } from './motion-slide.module'; + +describe('MotionSlideModule', () => { + let motionSlideModule: MotionSlideModule; + + beforeEach(() => { + motionSlideModule = new MotionSlideModule(); + }); + + it('should create an instance', () => { + expect(motionSlideModule).toBeTruthy(); + }); +}); diff --git a/client/src/app/slides/motions/motion/motion-slide.module.ts b/client/src/app/slides/motions/motion/motion-slide.module.ts new file mode 100644 index 000000000..16c3eba4d --- /dev/null +++ b/client/src/app/slides/motions/motion/motion-slide.module.ts @@ -0,0 +1,7 @@ +import { NgModule } from '@angular/core'; + +import { MotionSlideComponent } from './motion-slide.component'; +import { makeSlideModule } from 'app/slides/base-slide-module'; + +@NgModule(makeSlideModule(MotionSlideComponent)) +export class MotionSlideModule {} diff --git a/client/src/app/slides/motions/motion/motions-motion-slide.module.spec.ts b/client/src/app/slides/motions/motion/motions-motion-slide.module.spec.ts deleted file mode 100644 index 921a779e0..000000000 --- a/client/src/app/slides/motions/motion/motions-motion-slide.module.spec.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MotionsMotionSlideModule } from './motions-motion-slide.module'; - -describe('MotionsMotionSlideModule', () => { - let motionsMotionSlideModule: MotionsMotionSlideModule; - - beforeEach(() => { - motionsMotionSlideModule = new MotionsMotionSlideModule(); - }); - - it('should create an instance', () => { - expect(motionsMotionSlideModule).toBeTruthy(); - }); -}); diff --git a/client/src/app/slides/motions/motion/motions-motion-slide.module.ts b/client/src/app/slides/motions/motion/motions-motion-slide.module.ts deleted file mode 100644 index 39f04f618..000000000 --- a/client/src/app/slides/motions/motion/motions-motion-slide.module.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { MotionsMotionSlideComponent } from './motions-motion-slide.component'; -import { makeSlideModule } from 'app/slides/base-slide-module'; - -@NgModule(makeSlideModule(MotionsMotionSlideComponent)) -export class MotionsMotionSlideModule {} diff --git a/openslides/motions/projector.py b/openslides/motions/projector.py index 9a02d1b21..bca0e7897 100644 --- a/openslides/motions/projector.py +++ b/openslides/motions/projector.py @@ -206,9 +206,45 @@ def motion_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: def motion_block_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ - Motion slide. + Motion block slide. """ - return {"error": "TODO"} + motion_block_id = element.get("id") + + if motion_block_id is None: + raise ProjectorElementException("id is required for motion block slide") + + try: + motion_block = all_data["motions/motion-block"][motion_block_id] + except KeyError: + raise ProjectorElementException( + f"motion block with id {motion_block_id} does not exist" + ) + + motions = [] + for motion in all_data["motions/motion"].values(): + if motion["motion_block_id"] == motion_block_id: + motion_object = { + "title": motion["title"], + "identifier": motion["identifier"], + } + + recommendation_id = motion["recommendation_id"] + if recommendation_id is not None: + recommendation = get_state( + all_data, motion, motion["recommendation_id"] + ) + motion_object["recommendation"] = { + "name": recommendation["name"], + "css_class": recommendation["css_class"], + } + if recommendation["show_recommendation_extension_field"]: + motion_object["recommendation_extension"] = motion[ + "recommendation_extension" + ] + + motions.append(motion_object) + + return {"title": motion_block["title"], "motions": motions} def register_projector_slides() -> None: