Merge pull request #5063 from GabrielInTheWorld/addsTitleToAgenda

Extends the title of the agenda-items
This commit is contained in:
Emanuel Schütze 2019-10-02 16:57:11 +02:00 committed by GitHub
commit c2c1186da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 24 deletions

View File

@ -96,14 +96,12 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository<
* *
* @returns An optional subtitle as `string`. Defaults to `null`. * @returns An optional subtitle as `string`. Defaults to `null`.
*/ */
public getSubtitle = (titleInformation: ItemTitleInformation) => { public getSubtitle = (viewItem: ViewItem) => {
if (titleInformation.contentObject) { if (viewItem.contentObject) {
return titleInformation.contentObject.getAgendaSubtitle(); return viewItem.contentObject.getAgendaSubtitle();
} else { } else {
const repo = this.collectionStringMapperService.getRepository( // The subtitle is not present in the title_information yet.
titleInformation.contentObjectData.collection return null;
) as BaseIsAgendaItemContentObjectRepository<any, any, any>;
return repo.getAgendaSubtitle(titleInformation.title_information);
} }
}; };

View File

@ -59,14 +59,7 @@ export abstract class BaseIsAgendaItemAndListOfSpeakersContentObjectRepository<
return numberPrefix + this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')'; return numberPrefix + this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')';
} }
/** public getAgendaSubtitle(viewModel: V): string | null {
* 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 {
return null; return null;
} }

View File

@ -87,11 +87,10 @@ export abstract class BaseIsAgendaItemContentObjectRepository<
/** /**
* Overrides the base function. Returns an optional subtitle. * 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`. * @returns A string as subtitle. Defaults to `null`.
*/ */
public getAgendaSubtitle(titleInformation: T): string | null { public getAgendaSubtitle(viewModel: V): string | null {
return null; return null;
} }

View File

@ -287,17 +287,23 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo
const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : '';
// Append the verbose name only, if not the special format 'Motion <identifier>' is used. // Append the verbose name only, if not the special format 'Motion <identifier>' is used.
if (titleInformation.identifier) { if (titleInformation.identifier) {
return numberPrefix + this.translate.instant('Motion') + ' ' + titleInformation.identifier; return `${numberPrefix}${this.translate.instant('Motion')} ${titleInformation.identifier} · ${
titleInformation.title
}`;
} else { } else {
return numberPrefix + titleInformation.title + ' (' + this.getVerboseName() + ')'; return `${numberPrefix}${titleInformation.title} (${this.getVerboseName()})`;
} }
}; };
/** /**
* @override The base function and returns the submitters as optional subtitle. * @override The base function and returns the submitters as optional subtitle.
*/ */
public getAgendaSubtitle = (model: ViewMotion) => { public getAgendaSubtitle = (motion: ViewMotion) => {
return model.submittersAsUsers.join(', '); if (motion.submittersAsUsers && motion.submittersAsUsers.length) {
return `${this.translate.instant('by')} ${motion.submittersAsUsers.join(', ')}`;
} else {
return null;
}
}; };
/** /**

View File

@ -36,7 +36,7 @@
*ngIf="!isMultiSelect" *ngIf="!isMultiSelect"
></a> ></a>
<div [ngStyle]="{ 'margin-left': item.level * 25 + 'px' }"> <div [ngStyle]="{ 'margin-left': item.level * 25 + 'px' }">
<os-icon-container [icon]="item.closed ? 'check' : null" size="large"> <os-icon-container [noWrap]="true" [icon]="item.closed ? 'check' : null" size="large">
<div> <div>
<div> <div>
{{ item.getListTitle() }} {{ item.getListTitle() }}
@ -61,6 +61,9 @@
</os-icon-container> </os-icon-container>
</div> </div>
</div> </div>
<div *ngIf="item.comment" class="align-right">
<os-icon-container [matTooltip]="item.comment" icon="comment"></os-icon-container>
</div>
</div> </div>
<!-- Menu --> <!-- Menu -->

View File

@ -13,6 +13,9 @@
width: $icon-size; width: $icon-size;
} }
} }
.align-right {
margin-left: auto;
}
/* /*
* Where is this used? * Where is this used?

View File

@ -47,7 +47,7 @@ export abstract class BaseViewModelWithAgendaItemAndListOfSpeakers<
public getAgendaSlideTitle: () => string; public getAgendaSlideTitle: () => string;
public getAgendaListTitle: () => string; public getAgendaListTitle: () => string;
public getAgendaListTitleWithoutItemNumber: () => string; public getAgendaListTitleWithoutItemNumber: () => string;
public getAgendaSubtitle: () => string; public getAgendaSubtitle: () => string | null;
public getListOfSpeakersTitle: () => string; public getListOfSpeakersTitle: () => string;
public getListOfSpeakersSlideTitle: () => string; public getListOfSpeakersSlideTitle: () => string;