2018-12-06 12:28:05 +01:00
|
|
|
import { MotionBlock } from 'app/shared/models/motions/motion-block';
|
2019-02-01 13:56:08 +01:00
|
|
|
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';
|
2019-04-23 16:57:35 +02:00
|
|
|
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
|
|
|
|
*/
|
2019-04-23 16:57:35 +02:00
|
|
|
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 {
|
2019-04-23 16:57:35 +02:00
|
|
|
return this._model;
|
2018-12-06 12:28:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public get title(): string {
|
2019-02-01 13:56:08 +01:00
|
|
|
return this.motionBlock.title;
|
2018-12-06 12:28:05 +01:00
|
|
|
}
|
|
|
|
|
2019-05-21 13:52:10 +02:00
|
|
|
public get internal(): boolean {
|
|
|
|
return this.motionBlock.internal;
|
|
|
|
}
|
|
|
|
|
2019-04-23 16:57:35 +02:00
|
|
|
public constructor(motionBlock: MotionBlock, agendaItem?: ViewItem, listOfSpeakers?: ViewListOfSpeakers) {
|
|
|
|
super(MotionBlock.COLLECTIONSTRING, motionBlock, agendaItem, listOfSpeakers);
|
2019-02-01 13:56:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Formats the category for search
|
|
|
|
*
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
public formatForSearch(): SearchRepresentation {
|
|
|
|
return [this.title];
|
2018-12-06 12:28:05 +01:00
|
|
|
}
|
|
|
|
|
2019-02-01 13:56:08 +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()
|
|
|
|
};
|
2019-02-01 13:56:08 +01:00
|
|
|
}
|
2018-12-06 12:28:05 +01:00
|
|
|
}
|