Merge pull request #4072 from MaximilianKrambach/agendaexport_internalItem

simpler csv export option for agenda type
This commit is contained in:
Finn Stutzenstein 2018-12-20 08:08:52 +01:00 committed by GitHub
commit 5718c6f326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 4 deletions

View File

@ -15,9 +15,9 @@ interface ContentObject {
* Coming from "OpenSlidesConfigVariables" property "agenda_hide_internal_items_on_projector"
*/
export const itemVisibilityChoices = [
{ key: 1, name: 'Public item' },
{ key: 2, name: 'Internal item' },
{ key: 3, name: 'Hidden item' }
{ key: 1, name: 'Public item', csvName: '' },
{ key: 2, name: 'Internal item', csvName: 'internal' },
{ key: 3, name: 'Hidden item', csvName: 'hidden' }
];
/**
@ -73,6 +73,18 @@ export class Item extends ProjectableBaseModel {
return type ? type.name : '';
}
/**
* Gets a shortened string for CSV export
* @returns empty string if it is a public item, 'internal' or 'hidden' otherwise
*/
public get verboseCsvType(): string {
if (!this.type) {
return '';
}
const type = itemVisibilityChoices.find(choice => choice.key === this.type);
return type ? type.csvName : '';
}
public getTitle(): string {
return this.title;
}

View File

@ -51,6 +51,13 @@ export class ViewItem extends BaseViewModel {
return '';
}
public get verboseCsvType() : string {
if (this.item) {
return this.item.verboseCsvType;
}
return '';
}
public constructor(item: Item, contentObject: AgendaBaseModel) {
super();
this._item = item;

View File

@ -33,7 +33,7 @@ export class AgendaCsvExportService {
{ label: 'Text', map: viewItem => viewItem.contentObject ? viewItem.contentObject.getCSVExportText() : '' },
{ label: 'Duration', property: 'duration' },
{ label: 'Comment', property: 'comment' },
{ label: 'Item type', property: 'verboseType' }
{ label: 'Item type', property: 'verboseCsvType' }
],
this.translate.instant('Agenda') + '.csv'
);