From 63f1802d7a1fc639ae0c18456cc00d19bc1c259a Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 21 Feb 2019 14:40:07 +0100 Subject: [PATCH] (Current) list of speaker slide --- .../app/site/common/common-routing.module.ts | 1 + .../src/app/site/common/common.module.spec.ts | 13 ---- .../app/site/common/os-common.module.spec.ts | 13 ++++ .../{common.module.ts => os-common.module.ts} | 6 +- .../projector-detail.component.html | 7 +-- client/src/app/site/site-routing.module.ts | 2 +- .../current-list-of-speakers-slide-data.ts | 3 - .../common-list-of-speakers-slide-data.ts} | 2 +- ...mon-list-of-speakers-slide.component.html} | 2 +- ...mon-list-of-speakers-slide.component.scss} | 0 ...-list-of-speakers-slide.component.spec.ts} | 10 +-- ...ommon-list-of-speakers-slide.component.ts} | 10 +-- ...mmon-list-of-speakers-slide.module.spec.ts | 13 ++++ .../common-list-of-speakers-slide.module.ts | 13 ++++ ...t-of-speakers-overlay-slide.component.html | 4 +- ...ist-of-speakers-overlay-slide.component.ts | 12 +++- ...rent-list-of-speakers-slide.component.html | 3 - ...rent-list-of-speakers-slide.component.scss | 0 ...t-list-of-speakers-slide.component.spec.ts | 26 -------- ...urrent-list-of-speakers-slide.component.ts | 18 ------ ...rent-list-of-speakers-slide.module.spec.ts | 13 ---- .../current-list-of-speakers-slide.module.ts | 12 +++- .../list-of-speakers-slide.module.spec.ts | 13 ---- .../list-of-speakers-slide.module.ts | 12 +++- openslides/agenda/projector.py | 62 ++++++++++++++++--- openslides/assignments/projector.py | 4 +- openslides/core/projector.py | 12 +++- openslides/mediafiles/projector.py | 4 +- openslides/motions/projector.py | 8 ++- openslides/topics/projector.py | 4 +- openslides/users/projector.py | 4 +- openslides/utils/projector.py | 4 +- tests/integration/helpers.py | 8 ++- tests/unit/agenda/test_projector.py | 4 +- tests/unit/motions/test_projector.py | 6 +- 35 files changed, 179 insertions(+), 149 deletions(-) delete mode 100644 client/src/app/site/common/common.module.spec.ts create mode 100644 client/src/app/site/common/os-common.module.spec.ts rename client/src/app/site/common/{common.module.ts => os-common.module.ts} (80%) delete mode 100644 client/src/app/slides/agenda/base/current-list-of-speakers-slide-data.ts rename client/src/app/slides/agenda/{list-of-speakers/list-of-speakers-slide-data.ts => common/common-list-of-speakers-slide-data.ts} (83%) rename client/src/app/slides/agenda/{list-of-speakers/list-of-speakers-slide.component.html => common/common-list-of-speakers-slide.component.html} (95%) rename client/src/app/slides/agenda/{list-of-speakers/list-of-speakers-slide.component.scss => common/common-list-of-speakers-slide.component.scss} (100%) rename client/src/app/slides/agenda/{list-of-speakers/list-of-speakers-slide.component.spec.ts => common/common-list-of-speakers-slide.component.spec.ts} (59%) rename client/src/app/slides/agenda/{list-of-speakers/list-of-speakers-slide.component.ts => common/common-list-of-speakers-slide.component.ts} (72%) create mode 100644 client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.spec.ts create mode 100644 client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.ts delete mode 100644 client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.html delete mode 100644 client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.scss delete mode 100644 client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.spec.ts delete mode 100644 client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.ts delete mode 100644 client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.spec.ts delete mode 100644 client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.spec.ts diff --git a/client/src/app/site/common/common-routing.module.ts b/client/src/app/site/common/common-routing.module.ts index 91eadfc70..0f14b5d95 100644 --- a/client/src/app/site/common/common-routing.module.ts +++ b/client/src/app/site/common/common-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; + import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component'; import { StartComponent } from './components/start/start.component'; import { LegalNoticeComponent } from './components/legal-notice/legal-notice.component'; diff --git a/client/src/app/site/common/common.module.spec.ts b/client/src/app/site/common/common.module.spec.ts deleted file mode 100644 index 06175936f..000000000 --- a/client/src/app/site/common/common.module.spec.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CommonModule } from './common.module'; - -describe('CommonModule', () => { - let commonModule: CommonModule; - - beforeEach(() => { - commonModule = new CommonModule(); - }); - - it('should create an instance', () => { - expect(commonModule).toBeTruthy(); - }); -}); diff --git a/client/src/app/site/common/os-common.module.spec.ts b/client/src/app/site/common/os-common.module.spec.ts new file mode 100644 index 000000000..efde3cc74 --- /dev/null +++ b/client/src/app/site/common/os-common.module.spec.ts @@ -0,0 +1,13 @@ +import { OsCommonModule } from './os-common.module'; + +describe('OsCommonModule', () => { + let osCommonModule: OsCommonModule; + + beforeEach(() => { + osCommonModule = new OsCommonModule(); + }); + + it('should create an instance', () => { + expect(osCommonModule).toBeTruthy(); + }); +}); diff --git a/client/src/app/site/common/common.module.ts b/client/src/app/site/common/os-common.module.ts similarity index 80% rename from client/src/app/site/common/common.module.ts rename to client/src/app/site/common/os-common.module.ts index 2ab393a66..767172dd3 100644 --- a/client/src/app/site/common/common.module.ts +++ b/client/src/app/site/common/os-common.module.ts @@ -1,5 +1,5 @@ import { NgModule } from '@angular/core'; -import { CommonModule as AngularCommonModule } from '@angular/common'; +import { CommonModule } from '@angular/common'; import { CommonRoutingModule } from './common-routing.module'; import { SharedModule } from '../../shared/shared.module'; @@ -10,7 +10,7 @@ import { SearchComponent } from './components/search/search.component'; import { CountUsersComponent } from './components/count-users/count-users.component'; @NgModule({ - imports: [AngularCommonModule, CommonRoutingModule, SharedModule], + imports: [CommonModule, CommonRoutingModule, SharedModule], declarations: [PrivacyPolicyComponent, StartComponent, LegalNoticeComponent, SearchComponent, CountUsersComponent] }) -export class CommonModule {} +export class OsCommonModule {} diff --git a/client/src/app/site/projector/components/projector-detail/projector-detail.component.html b/client/src/app/site/projector/components/projector-detail/projector-detail.component.html index 65901aa99..fb6cbf5c2 100644 --- a/client/src/app/site/projector/components/projector-detail/projector-detail.component.html +++ b/client/src/app/site/projector/components/projector-detail/projector-detail.component.html @@ -7,14 +7,11 @@
- -
- -
+
diff --git a/client/src/app/site/site-routing.module.ts b/client/src/app/site/site-routing.module.ts index b5a21c703..8643d3704 100644 --- a/client/src/app/site/site-routing.module.ts +++ b/client/src/app/site/site-routing.module.ts @@ -16,7 +16,7 @@ const routes: Routes = [ children: [ { path: '', - loadChildren: './common/common.module#CommonModule', + loadChildren: './common/os-common.module#OsCommonModule', data: { preload: true } }, { diff --git a/client/src/app/slides/agenda/base/current-list-of-speakers-slide-data.ts b/client/src/app/slides/agenda/base/current-list-of-speakers-slide-data.ts deleted file mode 100644 index d3a113f1b..000000000 --- a/client/src/app/slides/agenda/base/current-list-of-speakers-slide-data.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface CurrentListOfSpeakersSlideData { - error: string; -} diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide-data.ts b/client/src/app/slides/agenda/common/common-list-of-speakers-slide-data.ts similarity index 83% rename from client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide-data.ts rename to client/src/app/slides/agenda/common/common-list-of-speakers-slide-data.ts index aaa07fbd6..e711ba381 100644 --- a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide-data.ts +++ b/client/src/app/slides/agenda/common/common-list-of-speakers-slide-data.ts @@ -3,7 +3,7 @@ interface SlideSpeaker { marked: boolean; } -export interface ListOfSpeakersSlideData { +export interface CommonListOfSpeakersSlideData { waiting: SlideSpeaker[]; current: SlideSpeaker; finished: SlideSpeaker[]; diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.html b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.html similarity index 95% rename from client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.html rename to client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.html index 6adcfa0c6..27415ae82 100644 --- a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.html +++ b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.html @@ -18,7 +18,7 @@
-
+
  1. {{ speaker.user }} diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.scss b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.scss similarity index 100% rename from client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.scss rename to client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.scss diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.spec.ts b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.spec.ts similarity index 59% rename from client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.spec.ts rename to client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.spec.ts index 1cae3241e..d158756ea 100644 --- a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.spec.ts +++ b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.spec.ts @@ -1,21 +1,21 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ListOfSpeakersSlideComponent } from './list-of-speakers-slide.component'; +import { CommonListOfSpeakersSlideComponent } from './common-list-of-speakers-slide.component'; import { E2EImportsModule } from '../../../../e2e-imports.module'; describe('ListOfSpeakersSlideComponent', () => { - let component: ListOfSpeakersSlideComponent; - let fixture: ComponentFixture; + let component: CommonListOfSpeakersSlideComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [E2EImportsModule], - declarations: [ListOfSpeakersSlideComponent] + declarations: [CommonListOfSpeakersSlideComponent] }).compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(ListOfSpeakersSlideComponent); + fixture = TestBed.createComponent(CommonListOfSpeakersSlideComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.ts b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.ts similarity index 72% rename from client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.ts rename to client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.ts index c68fc102f..03567e39f 100644 --- a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.component.ts +++ b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.component.ts @@ -1,16 +1,16 @@ import { Component } from '@angular/core'; import { BaseSlideComponent } from 'app/slides/base-slide-component'; -import { ListOfSpeakersSlideData } from './list-of-speakers-slide-data'; +import { CommonListOfSpeakersSlideData } from './common-list-of-speakers-slide-data'; import { CollectionStringMapperService } from 'app/core/core-services/collectionStringMapper.service'; import { isBaseAgendaContentObjectRepository } from 'app/core/repositories/base-agenda-content-object-repository'; @Component({ - selector: 'os-list-of-speakers-slide', - templateUrl: './list-of-speakers-slide.component.html', - styleUrls: ['./list-of-speakers-slide.component.scss'] + selector: 'os-common-list-of-speakers-slide', + templateUrl: './common-list-of-speakers-slide.component.html', + styleUrls: ['./common-list-of-speakers-slide.component.scss'] }) -export class ListOfSpeakersSlideComponent extends BaseSlideComponent { +export class CommonListOfSpeakersSlideComponent extends BaseSlideComponent { public constructor(private collectionStringMapperService: CollectionStringMapperService) { super(); } diff --git a/client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.spec.ts b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.spec.ts new file mode 100644 index 000000000..149936e6b --- /dev/null +++ b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.spec.ts @@ -0,0 +1,13 @@ +import { CommonListOfSpeakersSlideModule } from './common-list-of-speakers-slide.module'; + +describe('CommonListOfSpeakersSlideModule', () => { + let commonListOfSpeakersSlideModule: CommonListOfSpeakersSlideModule; + + beforeEach(() => { + commonListOfSpeakersSlideModule = new CommonListOfSpeakersSlideModule(); + }); + + it('should create an instance', () => { + expect(commonListOfSpeakersSlideModule).toBeTruthy(); + }); +}); diff --git a/client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.ts b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.ts new file mode 100644 index 000000000..a1297cecc --- /dev/null +++ b/client/src/app/slides/agenda/common/common-list-of-speakers-slide.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { CommonListOfSpeakersSlideComponent } from './common-list-of-speakers-slide.component'; +import { SharedModule } from '../../../shared/shared.module'; + +@NgModule({ + declarations: [CommonListOfSpeakersSlideComponent], + entryComponents: [CommonListOfSpeakersSlideComponent], + imports: [CommonModule, SharedModule], + exports: [CommonListOfSpeakersSlideComponent] +}) +export class CommonListOfSpeakersSlideModule {} diff --git a/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.html b/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.html index a6a56beac..dab29f33a 100644 --- a/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.html +++ b/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.html @@ -1,3 +1,3 @@ -
    - Current list of speakers overlay +
    + TODO
    diff --git a/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.ts b/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.ts index d8ab6f79a..4f4fbd9f7 100644 --- a/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.ts +++ b/client/src/app/slides/agenda/current-list-of-speakers-overlay/current-list-of-speakers-overlay-slide.component.ts @@ -1,14 +1,20 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { BaseSlideComponent } from 'app/slides/base-slide-component'; -import { CurrentListOfSpeakersSlideData } from '../base/current-list-of-speakers-slide-data'; +import { CommonListOfSpeakersSlideData } from '../common/common-list-of-speakers-slide-data'; @Component({ selector: 'os-current-list-of-speakers-overlay-slide', templateUrl: './current-list-of-speakers-overlay-slide.component.html', styleUrls: ['./current-list-of-speakers-overlay-slide.component.scss'] }) -export class CurrentListOfSpeakersOverlaySlideComponent extends BaseSlideComponent { +export class CurrentListOfSpeakersOverlaySlideComponent extends BaseSlideComponent { + // TODO: remove to access data in the template + @Input() + public set data(value: any) { + console.log(value.data); + } + public constructor() { super(); } diff --git a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.html b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.html deleted file mode 100644 index cef78fcdc..000000000 --- a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
    - Current list of speakers slide -
    diff --git a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.scss b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.spec.ts b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.spec.ts deleted file mode 100644 index 9294f79f8..000000000 --- a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CurrentListOfSpeakersSlideComponent } from './current-list-of-speakers-slide.component'; -import { E2EImportsModule } from '../../../../e2e-imports.module'; - -describe('CurrentListOfSpeakersSlideComponent', () => { - let component: CurrentListOfSpeakersSlideComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [E2EImportsModule], - declarations: [CurrentListOfSpeakersSlideComponent] - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CurrentListOfSpeakersSlideComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.ts b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.ts deleted file mode 100644 index ed84c50e7..000000000 --- a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -import { BaseSlideComponent } from 'app/slides/base-slide-component'; -import { CurrentListOfSpeakersSlideData } from '../base/current-list-of-speakers-slide-data'; - -@Component({ - selector: 'os-current-list-of-speakers-slide', - templateUrl: './current-list-of-speakers-slide.component.html', - styleUrls: ['./current-list-of-speakers-slide.component.scss'] -}) -export class CurrentListOfSpeakersSlideComponent extends BaseSlideComponent - implements OnInit { - public constructor() { - super(); - } - - public ngOnInit(): void {} -} diff --git a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.spec.ts b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.spec.ts deleted file mode 100644 index 68ee60fff..000000000 --- a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.spec.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CurrentListOfSpeakersSlideModule } from './current-list-of-speakers-slide.module'; - -describe('CurrentListOfSpeakersSlideModule', () => { - let currentListOfSpeakersSlideModule: CurrentListOfSpeakersSlideModule; - - beforeEach(() => { - currentListOfSpeakersSlideModule = new CurrentListOfSpeakersSlideModule(); - }); - - it('should create an instance', () => { - expect(currentListOfSpeakersSlideModule).toBeTruthy(); - }); -}); diff --git a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.ts b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.ts index 30ef00d3d..bf5b738ca 100644 --- a/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.ts +++ b/client/src/app/slides/agenda/current-list-of-speakers/current-list-of-speakers-slide.module.ts @@ -1,7 +1,13 @@ import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; -import { makeSlideModule } from 'app/slides/base-slide-module'; -import { CurrentListOfSpeakersSlideComponent } from './current-list-of-speakers-slide.component'; +import { SLIDE } from '../../slide-token'; +import { SharedModule } from 'app/shared/shared.module'; +import { CommonListOfSpeakersSlideModule } from '../common/common-list-of-speakers-slide.module'; +import { CommonListOfSpeakersSlideComponent } from '../common/common-list-of-speakers-slide.component'; -@NgModule(makeSlideModule(CurrentListOfSpeakersSlideComponent)) +@NgModule({ + imports: [CommonModule, SharedModule, CommonListOfSpeakersSlideModule], + providers: [{ provide: SLIDE, useValue: CommonListOfSpeakersSlideComponent }] +}) export class CurrentListOfSpeakersSlideModule {} diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.spec.ts b/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.spec.ts deleted file mode 100644 index 2655a8db0..000000000 --- a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.spec.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ListOfSpeakersSlideModule } from './list-of-speakers-slide.module'; - -describe('ListOfSpeakersSlideModule', () => { - let listOfSpeakersSlideModule: ListOfSpeakersSlideModule; - - beforeEach(() => { - listOfSpeakersSlideModule = new ListOfSpeakersSlideModule(); - }); - - it('should create an instance', () => { - expect(listOfSpeakersSlideModule).toBeTruthy(); - }); -}); diff --git a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.ts b/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.ts index 3b9ce14d0..b6ab62f93 100644 --- a/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.ts +++ b/client/src/app/slides/agenda/list-of-speakers/list-of-speakers-slide.module.ts @@ -1,7 +1,13 @@ import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; -import { makeSlideModule } from 'app/slides/base-slide-module'; -import { ListOfSpeakersSlideComponent } from './list-of-speakers-slide.component'; +import { SLIDE } from '../../slide-token'; +import { SharedModule } from 'app/shared/shared.module'; +import { CommonListOfSpeakersSlideModule } from '../common/common-list-of-speakers-slide.module'; +import { CommonListOfSpeakersSlideComponent } from '../common/common-list-of-speakers-slide.component'; -@NgModule(makeSlideModule(ListOfSpeakersSlideComponent)) +@NgModule({ + imports: [CommonModule, SharedModule, CommonListOfSpeakersSlideModule], + providers: [{ provide: SLIDE, useValue: CommonListOfSpeakersSlideComponent }] +}) export class ListOfSpeakersSlideModule {} diff --git a/openslides/agenda/projector.py b/openslides/agenda/projector.py index 73ab43b68..21f63f59f 100644 --- a/openslides/agenda/projector.py +++ b/openslides/agenda/projector.py @@ -56,7 +56,9 @@ def get_flat_tree(all_data: AllData, parent_id: int = 0) -> List[Dict[str, Any]] return tree -def item_list_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def item_list_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Item list slide. @@ -84,7 +86,7 @@ def item_list_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any def list_of_speakers_slide( - all_data: AllData, element: Dict[str, Any] + all_data: AllData, element: Dict[str, Any], projector_id: int ) -> Dict[str, Any]: """ List of speakers slide. @@ -96,6 +98,10 @@ def list_of_speakers_slide( if item_id is None: raise ProjectorElementException("id is required for list of speakers slide") + return get_list_of_speakers_slide_data(all_data, item_id) + + +def get_list_of_speakers_slide_data(all_data: AllData, item_id: int) -> Dict[str, Any]: try: item = all_data["agenda/item"][item_id] except KeyError: @@ -144,17 +150,53 @@ def list_of_speakers_slide( def current_list_of_speakers_slide( - all_data: AllData, element: Dict[str, Any] + all_data: AllData, element: Dict[str, Any], projector_id: int ) -> Dict[str, Any]: """ - TODO - - Note: This data is for all projectors showing this slide, so we cannot give projector- - specific data. The work-around is to make a dict with projector-ids as keys and the - data-per-projector as values. This is not a security concern, because if a person can - see one projector, he is able to see all others, too. Maybe a bit more data.. + The current list of speakers slide. Creates the data for the given projector. """ - return {"error": "TODO"} + try: + this_projector = all_data["core/projector"][projector_id] + except KeyError: + raise ProjectorElementException(f"Projector {projector_id} does not exist") + + reference_projector_id = this_projector["reference_projector_id"] or projector_id + try: + reference_projector = all_data["core/projector"][reference_projector_id] + except KeyError: + raise ProjectorElementException( + f"Projector {reference_projector_id} does not exist" + ) + + # Search for elements, that do have an agenda item: + # Try to get a model by the collection and id in the element. This + # model needs to have a 'agenda_item_id'. This item must exist. The first + # matching element is taken. + + elements = reference_projector["elements"] + item_id = None + for element in elements: + if "id" not in element: + continue + collection = element["name"] + id = element["id"] + if collection not in all_data or id not in all_data[collection]: + continue + + model = all_data[collection][id] + if "agenda_item_id" not in model: + continue + + if not model["agenda_item_id"] in all_data["agenda/item"]: + continue + + item_id = model["agenda_item_id"] + break + + if item_id is None: # no element found + return {} + + return get_list_of_speakers_slide_data(all_data, item_id) def register_projector_slides() -> None: diff --git a/openslides/assignments/projector.py b/openslides/assignments/projector.py index 58d4cdc74..5e4ae9836 100644 --- a/openslides/assignments/projector.py +++ b/openslides/assignments/projector.py @@ -9,7 +9,9 @@ from ..utils.projector import AllData, register_projector_slide # to be fast! -def assignment_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def assignment_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Assignment slide. """ diff --git a/openslides/core/projector.py b/openslides/core/projector.py index 5f464d7d5..193d4a33f 100644 --- a/openslides/core/projector.py +++ b/openslides/core/projector.py @@ -14,7 +14,9 @@ from ..utils.projector import ( # to be fast! -def countdown_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def countdown_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Countdown slide. @@ -40,7 +42,9 @@ def countdown_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any } -def message_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def message_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Message slide. @@ -59,7 +63,9 @@ def message_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: raise ProjectorElementException(f"Message {message_id} does not exist") -def clock_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def clock_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: return {} diff --git a/openslides/mediafiles/projector.py b/openslides/mediafiles/projector.py index c3394deda..db75eba65 100644 --- a/openslides/mediafiles/projector.py +++ b/openslides/mediafiles/projector.py @@ -13,7 +13,9 @@ from ..utils.projector import ( # to be fast! -def mediafile_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def mediafile_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Slide for Mediafile. """ diff --git a/openslides/motions/projector.py b/openslides/motions/projector.py index e46e6d08a..da00c3a32 100644 --- a/openslides/motions/projector.py +++ b/openslides/motions/projector.py @@ -97,7 +97,9 @@ def get_amendment_base_statute(amendment, all_data): return {"title": statute["title"], "text": statute["text"]} -def motion_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def motion_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Motion slide. @@ -204,7 +206,9 @@ def motion_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: return return_value -def motion_block_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def motion_block_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Motion block slide. """ diff --git a/openslides/topics/projector.py b/openslides/topics/projector.py index 43f7906a8..75a905cb9 100644 --- a/openslides/topics/projector.py +++ b/openslides/topics/projector.py @@ -13,7 +13,9 @@ from ..utils.projector import ( # to be fast! -def topic_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def topic_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Topic slide. diff --git a/openslides/users/projector.py b/openslides/users/projector.py index e1f55b7bf..cc56e8ded 100644 --- a/openslides/users/projector.py +++ b/openslides/users/projector.py @@ -13,7 +13,9 @@ from ..utils.projector import ( # to be fast! -def user_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def user_slide( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ User slide. diff --git a/openslides/utils/projector.py b/openslides/utils/projector.py index 5fdaaed71..60ad93983 100644 --- a/openslides/utils/projector.py +++ b/openslides/utils/projector.py @@ -11,7 +11,7 @@ from .cache import element_cache AllData = Dict[str, Dict[int, Dict[str, Any]]] -ProjectorSlide = Callable[[AllData, Dict[str, Any]], Dict[str, Any]] +ProjectorSlide = Callable[[AllData, Dict[str, Any], int], Dict[str, Any]] projector_slides: Dict[str, ProjectorSlide] = {} @@ -83,7 +83,7 @@ async def get_projector_data( for element in projector["elements"]: projector_slide = projector_slides[element["name"]] try: - data = projector_slide(all_data, element) + data = projector_slide(all_data, element, projector_id) except ProjectorElementException as err: data = {"error": str(err)} projector_data[projector_id].append({"data": data, "element": element}) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index b838f520c..01b78e7c6 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -90,14 +90,18 @@ class TProjector: return elements -def slide1(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def slide1( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: """ Slide that shows the general_event_name. """ return {"name": "slide1", "event_name": get_config(all_data, "general_event_name")} -def slide2(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: +def slide2( + all_data: AllData, element: Dict[str, Any], projector_id: int +) -> Dict[str, Any]: return {"name": "slide2"} diff --git a/tests/unit/agenda/test_projector.py b/tests/unit/agenda/test_projector.py index 3bd0653f0..319b2867a 100644 --- a/tests/unit/agenda/test_projector.py +++ b/tests/unit/agenda/test_projector.py @@ -88,7 +88,7 @@ def all_data(): def test_main_items(all_data): element: Dict[str, Any] = {} - data = projector.item_list_slide(all_data, element) + data = projector.item_list_slide(all_data, element, 1) assert data == { "items": [ @@ -109,7 +109,7 @@ def test_main_items(all_data): def test_all_items(all_data): element: Dict[str, Any] = {"only_main_items": False} - data = projector.item_list_slide(all_data, element) + data = projector.item_list_slide(all_data, element, 1) assert data == { "items": [ diff --git a/tests/unit/motions/test_projector.py b/tests/unit/motions/test_projector.py index c4311d031..dc5db4cd6 100644 --- a/tests/unit/motions/test_projector.py +++ b/tests/unit/motions/test_projector.py @@ -256,7 +256,7 @@ def all_data(): def test_motion_slide(all_data): element: Dict[str, Any] = {"id": 1} - data = projector.motion_slide(all_data, element) + data = projector.motion_slide(all_data, element, 1) assert data == { "identifier": "4", @@ -301,7 +301,7 @@ def test_motion_slide(all_data): def test_amendment_slide(all_data): element: Dict[str, Any] = {"id": 2} - data = projector.motion_slide(all_data, element) + data = projector.motion_slide(all_data, element, 1) assert data == { "identifier": "Ä1", @@ -325,7 +325,7 @@ def test_amendment_slide(all_data): def test_statute_amendment_slide(all_data): element: Dict[str, Any] = {"id": 3} - data = projector.motion_slide(all_data, element) + data = projector.motion_slide(all_data, element, 1) assert data == { "identifier": None,