2018-09-13 09:23:57 +02:00
|
|
|
import { AgendaInformation } from './agenda-information';
|
|
|
|
import { ProjectableBaseModel } from './projectable-base-model';
|
2018-11-07 08:43:48 +01:00
|
|
|
import { Searchable } from './searchable';
|
|
|
|
import { SearchRepresentation } from '../../../core/services/search.service';
|
2018-09-13 09:23:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A base model for models, that can be content objects in the agenda. Provides title and navigation
|
|
|
|
* information for the agenda.
|
|
|
|
*/
|
2018-11-07 08:43:48 +01:00
|
|
|
export abstract class AgendaBaseModel extends ProjectableBaseModel implements AgendaInformation, Searchable {
|
2018-09-13 09:23:57 +02:00
|
|
|
/**
|
2018-11-07 08:43:48 +01:00
|
|
|
* A model that can be a content object of an agenda item.
|
2018-09-13 09:23:57 +02:00
|
|
|
* @param collectionString
|
|
|
|
* @param verboseName
|
|
|
|
* @param input
|
|
|
|
*/
|
|
|
|
protected constructor(collectionString: string, verboseName: string, input?: any) {
|
2018-11-07 08:43:48 +01:00
|
|
|
super(collectionString, verboseName, input);
|
2018-09-13 09:23:57 +02:00
|
|
|
}
|
|
|
|
|
2018-11-07 08:43:48 +01:00
|
|
|
/**
|
|
|
|
* @returns the agenda title
|
|
|
|
*/
|
2018-09-13 09:23:57 +02:00
|
|
|
public getAgendaTitle(): string {
|
|
|
|
return this.getTitle();
|
|
|
|
}
|
|
|
|
|
2018-11-07 08:43:48 +01:00
|
|
|
/**
|
|
|
|
* @return the agenda title with the verbose name of the content object
|
|
|
|
*/
|
2018-09-13 09:23:57 +02:00
|
|
|
public getAgendaTitleWithType(): string {
|
|
|
|
// Return the agenda title with the model's verbose name appended
|
2018-11-07 08:43:48 +01:00
|
|
|
return this.getAgendaTitle() + ' (' + this.getVerboseName() + ')';
|
2018-09-13 09:23:57 +02:00
|
|
|
}
|
|
|
|
|
2018-11-07 08:43:48 +01:00
|
|
|
/**
|
|
|
|
* Should return a string representation of the object, so there can be searched for.
|
|
|
|
*/
|
|
|
|
public abstract formatForSearch(): SearchRepresentation;
|
|
|
|
|
2018-09-13 09:23:57 +02:00
|
|
|
/**
|
|
|
|
* Should return the URL to the detail view. Used for the agenda, that the
|
|
|
|
* user can navigate to the content object.
|
|
|
|
*/
|
|
|
|
public abstract getDetailStateURL(): string;
|
|
|
|
}
|