diff --git a/client/src/app/shared/models/core/countdown.ts b/client/src/app/shared/models/core/countdown.ts index f68d95da7..ca825ec43 100644 --- a/client/src/app/shared/models/core/countdown.ts +++ b/client/src/app/shared/models/core/countdown.ts @@ -8,7 +8,8 @@ export class Countdown extends BaseModel { public static COLLECTIONSTRING = 'core/countdown'; public id: number; - public description: string; + public description?: string; + public title: string; public default_time: number; public countdown_time: number; public running: boolean; diff --git a/client/src/app/site/agenda/models/view-topic.ts b/client/src/app/site/agenda/models/view-topic.ts index cd220ace7..e5451f405 100644 --- a/client/src/app/site/agenda/models/view-topic.ts +++ b/client/src/app/site/agenda/models/view-topic.ts @@ -64,7 +64,7 @@ export class ViewTopic extends BaseAgendaViewModel { } public getTitle = () => { - if (this.agendaItem) { + if (this.agendaItem && this.agendaItem.itemNumber) { return this.agendaItem.itemNumber + ' ยท ' + this.title; } else { return this.title; diff --git a/client/src/app/site/projector/components/countdown-list/countdown-list.component.html b/client/src/app/site/projector/components/countdown-list/countdown-list.component.html index caf500e12..80680dfe2 100644 --- a/client/src/app/site/projector/components/countdown-list/countdown-list.component.html +++ b/client/src/app/site/projector/components/countdown-list/countdown-list.component.html @@ -9,18 +9,23 @@ New countdown -
+

- - + + Required -

+

+

- + + +

+

+ + Required @@ -39,9 +44,13 @@ - - + @@ -50,7 +59,7 @@

- {{ countdown.description }} + {{ countdown.getTitle() | translate }}
@@ -58,20 +67,28 @@
- +
Edit countdown

- - + + Required -

+

+

- + + +

+

+ + Required @@ -79,19 +96,34 @@

- - - - diff --git a/client/src/app/site/projector/components/countdown-list/countdown-list.component.ts b/client/src/app/site/projector/components/countdown-list/countdown-list.component.ts index 9d1f2e629..b9d658728 100644 --- a/client/src/app/site/projector/components/countdown-list/countdown-list.component.ts +++ b/client/src/app/site/projector/components/countdown-list/countdown-list.component.ts @@ -50,8 +50,9 @@ export class CountdownListComponent extends BaseViewComponent implements OnInit super(titleService, translate, matSnackBar); const form = { - description: ['', Validators.required], - default_time: ['', Validators.required] + description: [''], + default_time: ['', Validators.required], + title: ['', Validators.required] }; this.createForm = this.formBuilder.group(form); this.updateForm = this.formBuilder.group(form); @@ -77,6 +78,7 @@ export class CountdownListComponent extends BaseViewComponent implements OnInit this.createForm.reset(); this.createForm.setValue({ description: '', + title: '', default_time: '1:00 m' }); this.countdownToCreate = new Countdown(); @@ -95,6 +97,7 @@ export class CountdownListComponent extends BaseViewComponent implements OnInit const newValues: Partial = { description: this.createForm.value.description, + title: this.createForm.value.title, default_time: default_time }; newValues.countdown_time = default_time; @@ -114,6 +117,7 @@ export class CountdownListComponent extends BaseViewComponent implements OnInit this.updateForm.setValue({ description: countdown.description, + title: this.translate.instant(countdown.title), default_time: this.durationService.durationToString(countdown.default_time, 'm') }); } @@ -129,6 +133,7 @@ export class CountdownListComponent extends BaseViewComponent implements OnInit default_time = 60; } const newValues: Partial = { + title: this.updateForm.value.title, description: this.updateForm.value.description, default_time: default_time }; @@ -147,7 +152,7 @@ export class CountdownListComponent extends BaseViewComponent implements OnInit * @param countdown The countdown to delete */ public async onDeleteButton(countdown: ViewCountdown): Promise { - const content = this.translate.instant('Delete countdown') + ` ${countdown.description}?`; + const content = this.translate.instant('Delete countdown') + ` ${this.translate.instant(countdown.title)}?`; if (await this.promptService.open('Are you sure?', content)) { this.repo.delete(countdown).then(() => (this.openId = this.editId = null), this.raiseError); } 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 a8ef04d89..6627c4441 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 @@ -14,7 +14,6 @@
-
{{ projector.scroll }}
-
@@ -73,7 +71,10 @@
- + @@ -96,7 +97,6 @@ Queue -
videocam - {{ countdown.description }} + {{ countdown.getTitle() | translate }} diff --git a/client/src/app/site/projector/models/view-countdown.ts b/client/src/app/site/projector/models/view-countdown.ts index d35e32675..bfc4e2c7d 100644 --- a/client/src/app/site/projector/models/view-countdown.ts +++ b/client/src/app/site/projector/models/view-countdown.ts @@ -29,7 +29,11 @@ export class ViewCountdown extends BaseProjectableViewModel { } public get description(): string { - return this.countdown.description; + return this.countdown.description || ''; + } + + public get title(): string { + return this.countdown.title; } /** @@ -42,8 +46,12 @@ export class ViewCountdown extends BaseProjectableViewModel { this._countdown = countdown; } + /** + * @returns a title for the countdown, consisting of the title and additional + * text info that may be displayed on the projector + */ public getTitle = () => { - return this.description; + return this.description ? `${this.title} (${this.description})` : this.title; }; public updateDependencies(update: BaseViewModel): void {} diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 04d173491..1e04febe6 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -423,6 +423,7 @@ class Speaker(RESTModelMixin, models.Model): pk=1, defaults={ "default_time": config["projector_default_countdown"], + "title": "Default countdown", "countdown_time": config["projector_default_countdown"], }, ) diff --git a/openslides/core/migrations/0019_countdown_title_1.py b/openslides/core/migrations/0019_countdown_title_1.py new file mode 100644 index 000000000..c0408b021 --- /dev/null +++ b/openslides/core/migrations/0019_countdown_title_1.py @@ -0,0 +1,15 @@ +# Generated by Django 2.1.5 on 2019-02-27 11:17 + +from django.db import migrations + + +def delete_old_countdowns(apps, schema_editor): + Countdowns = apps.get_model("core", "countdown") + Countdowns.objects.all().delete() + + +class Migration(migrations.Migration): + + dependencies = [("core", "0018_auto_20190222_1209")] + + operations = [migrations.RunPython(delete_old_countdowns)] diff --git a/openslides/core/migrations/0019_countdown_title_2.py b/openslides/core/migrations/0019_countdown_title_2.py new file mode 100644 index 000000000..011cb8b1b --- /dev/null +++ b/openslides/core/migrations/0019_countdown_title_2.py @@ -0,0 +1,16 @@ +# Generated by Django 2.1.5 on 2019-02-27 11:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [("core", "0019_countdown_title_1")] + + operations = [ + migrations.AddField( + model_name="countdown", + name="title", + field=models.CharField(max_length=256, unique=True), + ) + ] diff --git a/openslides/core/models.py b/openslides/core/models.py index 199ad26bb..dbe0b6f47 100644 --- a/openslides/core/models.py +++ b/openslides/core/models.py @@ -232,6 +232,8 @@ class Countdown(RESTModelMixin, models.Model): access_permissions = CountdownAccessPermissions() + title = models.CharField(max_length=256, unique=True, default="") + description = models.CharField(max_length=256, blank=True) running = models.BooleanField(default=False) diff --git a/openslides/core/serializers.py b/openslides/core/serializers.py index 1be511fab..06317ed6b 100644 --- a/openslides/core/serializers.py +++ b/openslides/core/serializers.py @@ -165,7 +165,15 @@ class CountdownSerializer(ModelSerializer): class Meta: model = Countdown - fields = ("id", "description", "default_time", "countdown_time", "running") + fields = ( + "id", + "title", + "description", + "default_time", + "countdown_time", + "running", + ) + unique_together = ("title",) class HistorySerializer(ModelSerializer):