OpenSlides/client/src/app/site/motions/models/view-motion-block.ts

65 lines
2.1 KiB
TypeScript
Raw Normal View History

2018-12-06 12:28:05 +01:00
import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { SearchRepresentation } from 'app/core/ui-services/search.service';
import { ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
import { Searchable } from 'app/site/base/searchable';
import { ViewItem } from 'app/site/agenda/models/view-item';
import { BaseViewModelWithAgendaItemAndListOfSpeakers } from 'app/site/base/base-view-model-with-agenda-item-and-list-of-speakers';
import { ViewListOfSpeakers } from 'app/site/agenda/models/view-list-of-speakers';
import { TitleInformationWithAgendaItem } from 'app/site/base/base-view-model-with-agenda-item';
export interface MotionBlockTitleInformation extends TitleInformationWithAgendaItem {
title: string;
}
2018-12-06 12:28:05 +01:00
/**
* ViewModel for motion blocks.
* @ignore
*/
export class ViewMotionBlock extends BaseViewModelWithAgendaItemAndListOfSpeakers
implements MotionBlockTitleInformation, Searchable {
2019-02-12 09:25:56 +01:00
public static COLLECTIONSTRING = MotionBlock.COLLECTIONSTRING;
2018-12-06 12:28:05 +01:00
public get motionBlock(): MotionBlock {
return this._model;
2018-12-06 12:28:05 +01:00
}
public get title(): string {
return this.motionBlock.title;
2018-12-06 12:28:05 +01:00
}
public constructor(motionBlock: MotionBlock, agendaItem?: ViewItem, listOfSpeakers?: ViewListOfSpeakers) {
super(MotionBlock.COLLECTIONSTRING, motionBlock, agendaItem, listOfSpeakers);
}
/**
* Formats the category for search
*
* @override
*/
public formatForSearch(): SearchRepresentation {
return [this.title];
2018-12-06 12:28:05 +01:00
}
/**
* Get the URL to the motion block
*
* @returns the URL as string
*/
public getDetailStateURL(): string {
return `/motions/blocks/${this.id}`;
}
public getSlide(): ProjectorElementBuildDeskriptor {
2019-02-21 12:34:13 +01:00
return {
getBasicProjectorElement: options => ({
name: MotionBlock.COLLECTIONSTRING,
id: this.id,
getIdentifiers: () => ['name', 'id']
}),
slideOptions: [],
projectionDefaultName: 'motionBlocks',
getDialogTitle: () => this.getTitle()
};
}
2018-12-06 12:28:05 +01:00
}