From 6c98fbcb833484340ffab8775b47df7bd49d9224 Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Tue, 1 Oct 2019 14:40:10 +0200 Subject: [PATCH] Extends the title of the agenda-items --- .../repositories/agenda/item-repository.service.ts | 12 +++++------- ...d-list-of-speakers-content-object-repository.ts | 9 +-------- ...ase-is-agenda-item-content-object-repository.ts | 5 ++--- .../motions/motion-repository.service.ts | 14 ++++++++++---- .../agenda-list/agenda-list.component.html | 5 ++++- .../agenda-list/agenda-list.component.scss | 3 +++ ...-model-with-agenda-item-and-list-of-speakers.ts | 2 +- 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/client/src/app/core/repositories/agenda/item-repository.service.ts b/client/src/app/core/repositories/agenda/item-repository.service.ts index da4c7abca..0c7995475 100644 --- a/client/src/app/core/repositories/agenda/item-repository.service.ts +++ b/client/src/app/core/repositories/agenda/item-repository.service.ts @@ -96,14 +96,12 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository< * * @returns An optional subtitle as `string`. Defaults to `null`. */ - public getSubtitle = (titleInformation: ItemTitleInformation) => { - if (titleInformation.contentObject) { - return titleInformation.contentObject.getAgendaSubtitle(); + public getSubtitle = (viewItem: ViewItem) => { + if (viewItem.contentObject) { + return viewItem.contentObject.getAgendaSubtitle(); } else { - const repo = this.collectionStringMapperService.getRepository( - titleInformation.contentObjectData.collection - ) as BaseIsAgendaItemContentObjectRepository; - return repo.getAgendaSubtitle(titleInformation.title_information); + // The subtitle is not present in the title_information yet. + return null; } }; diff --git a/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts b/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts index 7cd046150..7145a8769 100644 --- a/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts +++ b/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts @@ -59,14 +59,7 @@ export abstract class BaseIsAgendaItemAndListOfSpeakersContentObjectRepository< return numberPrefix + this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')'; } - /** - * Overwrites the base function. - * - * @param titleInformation The information about the model. - * - * @returns {string | null} An optional subtitle. `Null`, if it returns no subtitle, otherwise `string`. - */ - public getAgendaSubtitle(titleInformation: T): string | null { + public getAgendaSubtitle(viewModel: V): string | null { return null; } diff --git a/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts b/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts index fe8f5fa53..d72c36f7b 100644 --- a/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts +++ b/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts @@ -87,11 +87,10 @@ export abstract class BaseIsAgendaItemContentObjectRepository< /** * Overrides the base function. Returns an optional subtitle. * - * @param titleInformation The information about the underlying model. - * + * @param viewModel The model to get the subtitle from. * @returns A string as subtitle. Defaults to `null`. */ - public getAgendaSubtitle(titleInformation: T): string | null { + public getAgendaSubtitle(viewModel: V): string | null { return null; } 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 88b94c7b3..f5d432285 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -287,17 +287,23 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; // Append the verbose name only, if not the special format 'Motion ' is used. if (titleInformation.identifier) { - return numberPrefix + this.translate.instant('Motion') + ' ' + titleInformation.identifier; + return `${numberPrefix}${this.translate.instant('Motion')} ${titleInformation.identifier} · ${ + titleInformation.title + }`; } else { - return numberPrefix + titleInformation.title + ' (' + this.getVerboseName() + ')'; + return `${numberPrefix}${titleInformation.title} (${this.getVerboseName()})`; } }; /** * @override The base function and returns the submitters as optional subtitle. */ - public getAgendaSubtitle = (model: ViewMotion) => { - return model.submittersAsUsers.join(', '); + public getAgendaSubtitle = (motion: ViewMotion) => { + if (motion.submittersAsUsers && motion.submittersAsUsers.length) { + return `${this.translate.instant('by')} ${motion.submittersAsUsers.join(', ')}`; + } else { + return null; + } }; /** diff --git a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.html b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.html index 9cf8432fe..8ab7ff0d5 100644 --- a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.html +++ b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.html @@ -36,7 +36,7 @@ *ngIf="!isMultiSelect" >
- +
{{ item.getListTitle() }} @@ -61,6 +61,9 @@
+
+ +
diff --git a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss index f3d57549d..325e6aa30 100644 --- a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss +++ b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss @@ -13,6 +13,9 @@ width: $icon-size; } } +.align-right { + margin-left: auto; +} /* * Where is this used? diff --git a/client/src/app/site/base/base-view-model-with-agenda-item-and-list-of-speakers.ts b/client/src/app/site/base/base-view-model-with-agenda-item-and-list-of-speakers.ts index cc86b9062..024296bf0 100644 --- a/client/src/app/site/base/base-view-model-with-agenda-item-and-list-of-speakers.ts +++ b/client/src/app/site/base/base-view-model-with-agenda-item-and-list-of-speakers.ts @@ -47,7 +47,7 @@ export abstract class BaseViewModelWithAgendaItemAndListOfSpeakers< public getAgendaSlideTitle: () => string; public getAgendaListTitle: () => string; public getAgendaListTitleWithoutItemNumber: () => string; - public getAgendaSubtitle: () => string; + public getAgendaSubtitle: () => string | null; public getListOfSpeakersTitle: () => string; public getListOfSpeakersSlideTitle: () => string;