Removes the item-number from items in PDF

- ...for exporting the agenda-list.
- Fixes #4965
This commit is contained in:
GabrielMeyer 2019-09-02 14:52:08 +02:00
parent d1c63f74fd
commit cc456fdb5a
8 changed files with 73 additions and 1 deletions

View File

@ -91,6 +91,22 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository<
}
};
/**
* Overrides the base function.
*
* @returns The title without any prefix like item number.
*/
public getTitleWithoutItemNumber = (titleInformation: ItemTitleInformation) => {
if (titleInformation.contentObject) {
return titleInformation.contentObject.getAgendaListTitleWithoutItemNumber();
} else {
const repo = this.collectionStringMapperService.getRepository(
titleInformation.contentObjectData.collection
) as BaseIsAgendaItemContentObjectRepository<any, any, any>;
return repo.getAgendaListTitleWithoutItemNumber(titleInformation.title_information);
}
};
/**
* Trigger the automatic numbering sequence on the server
*/

View File

@ -64,6 +64,17 @@ export abstract class BaseIsAgendaItemAndListOfSpeakersContentObjectRepository<
return numberPrefix + this.getTitle(titleInformation);
}
/**
* Function to get the list-title without the item-number.
*
* @param titleInformation The title-information for an object.
*
* @returns {string} The title without any prefix like item-number.
*/
public getAgendaListTitleWithoutItemNumber(titleInformation: T): string {
return this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')';
}
public getListOfSpeakersTitle = (titleInformation: T) => {
return this.getAgendaListTitle(titleInformation);
};
@ -75,6 +86,7 @@ export abstract class BaseIsAgendaItemAndListOfSpeakersContentObjectRepository<
protected createViewModelWithTitles(model: M, initialLoading: boolean): V {
const viewModel = super.createViewModelWithTitles(model, initialLoading);
viewModel.getAgendaListTitle = () => this.getAgendaListTitle(viewModel);
viewModel.getAgendaListTitleWithoutItemNumber = () => this.getAgendaListTitleWithoutItemNumber(viewModel);
viewModel.getAgendaSlideTitle = () => this.getAgendaSlideTitle(viewModel);
viewModel.getListOfSpeakersTitle = () => this.getListOfSpeakersTitle(viewModel);
viewModel.getListOfSpeakersSlideTitle = () => this.getListOfSpeakersSlideTitle(viewModel);

View File

@ -30,6 +30,7 @@ export interface IBaseIsAgendaItemContentObjectRepository<
T extends TitleInformationWithAgendaItem
> extends BaseRepository<V, M, T> {
getAgendaListTitle: (titleInformation: T) => string;
getAgendaListTitleWithoutItemNumber: (titleInformation: T) => string;
getAgendaSlideTitle: (titleInformation: T) => string;
}
@ -83,6 +84,17 @@ export abstract class BaseIsAgendaItemContentObjectRepository<
return numberPrefix + this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')';
}
/**
* Function to return the title without item-number, in example used for pdf-creation.
*
* @param titleInformation The title information.
*
* @returns {string} The title without any prefix like the item-number.
*/
public getAgendaListTitleWithoutItemNumber(titleInformation: T): string {
return this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')';
}
/**
* @returns the agenda title for the item slides
*/
@ -96,6 +108,7 @@ export abstract class BaseIsAgendaItemContentObjectRepository<
protected createViewModelWithTitles(model: M, initialLoading: boolean): V {
const viewModel = super.createViewModelWithTitles(model, initialLoading);
viewModel.getAgendaListTitle = () => this.getAgendaListTitle(viewModel);
viewModel.getAgendaListTitleWithoutItemNumber = () => this.getAgendaListTitleWithoutItemNumber(viewModel);
viewModel.getAgendaSlideTitle = () => this.getAgendaSlideTitle(viewModel);
return viewModel;
}

View File

@ -267,6 +267,17 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo
}
};
/**
* @override The base function
*/
public getAgendaListTitleWithoutItemNumber = (titleInformation: MotionTitleInformation) => {
if (titleInformation.identifier) {
return this.translate.instant('Motion') + ' ' + titleInformation.identifier;
} else {
return titleInformation.title + `(${this.getVerboseName()})`;
}
};
public getVerboseName = (plural: boolean = false) => {
return this.translate.instant(plural ? 'Motions' : 'Motion');
};

View File

@ -69,6 +69,15 @@ export class TopicRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCon
return this.getTitle(titleInformation);
};
/**
* @override The base function.
*
* @returns The plain title.
*/
public getAgendaListTitleWithoutItemNumber = (titleInformation: TopicTitleInformation) => {
return titleInformation.title;
};
public getVerboseName = (plural: boolean = false) => {
return this.translate.instant(plural ? 'Topics' : 'Topic');
};

View File

@ -87,7 +87,7 @@ export class AgendaPdfService {
text: nodeItem.item.itemNumber
},
{
text: nodeItem.item.getTitle()
text: nodeItem.item.contentObject.getAgendaListTitleWithoutItemNumber()
}
]
};

View File

@ -46,6 +46,7 @@ export abstract class BaseViewModelWithAgendaItemAndListOfSpeakers<
public getAgendaSlideTitle: () => string;
public getAgendaListTitle: () => string;
public getAgendaListTitleWithoutItemNumber: () => string;
public getListOfSpeakersTitle: () => string;
public getListOfSpeakersSlideTitle: () => string;

View File

@ -46,6 +46,11 @@ export interface IBaseViewModelWithAgendaItem<M extends BaseModelWithAgendaItem
*/
getAgendaListTitle: () => string;
/**
* @return the agenda title with the verbose name of the content object
*/
getAgendaListTitleWithoutItemNumber: () => string;
/**
* @returns the (optional) descriptive text to be exported in the CSV.
* May be overridden by inheriting classes
@ -85,6 +90,11 @@ export abstract class BaseViewModelWithAgendaItem<M extends BaseModelWithAgendaI
*/
public getAgendaListTitle: () => string;
/**
* @return the agenda title without any item number.
*/
public getAgendaListTitleWithoutItemNumber: () => string;
public constructor(model: M, item?: any) {
super(model);
this._item = item || null; // Explicit set to null instead of undefined, if not given