OpenSlides/client/src/app/site/motions/models/view-motion-block.ts
FinnStutzenstein 658b1a360d Internal flag for motion blocks
- ServerSide
- Adds the 'internal'-flag to the edit view of motion blocks
2019-05-28 15:24:22 +02:00

69 lines
2.2 KiB
TypeScript

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;
}
/**
* ViewModel for motion blocks.
* @ignore
*/
export class ViewMotionBlock extends BaseViewModelWithAgendaItemAndListOfSpeakers
implements MotionBlockTitleInformation, Searchable {
public static COLLECTIONSTRING = MotionBlock.COLLECTIONSTRING;
public get motionBlock(): MotionBlock {
return this._model;
}
public get title(): string {
return this.motionBlock.title;
}
public get internal(): boolean {
return this.motionBlock.internal;
}
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];
}
/**
* Get the URL to the motion block
*
* @returns the URL as string
*/
public getDetailStateURL(): string {
return `/motions/blocks/${this.id}`;
}
public getSlide(): ProjectorElementBuildDeskriptor {
return {
getBasicProjectorElement: options => ({
name: MotionBlock.COLLECTIONSTRING,
id: this.id,
getIdentifiers: () => ['name', 'id']
}),
slideOptions: [],
projectionDefaultName: 'motionBlocks',
getDialogTitle: () => this.getTitle()
};
}
}