Merge pull request #4939 from tsiegleauq/filter-has-speaker

Add speakers-filter to motion list
This commit is contained in:
Emanuel Schütze 2019-08-23 08:35:47 +02:00 committed by GitHub
commit afb804b7a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -329,6 +329,10 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers<Mot
return !!this.personalNote && !!this.personalNote.note;
}
public get hasSpeakers(): boolean {
return this.speakerAmount > 0;
}
/**
* Translate the state's css class into a color
*

View File

@ -88,6 +88,15 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
options: []
};
public hasSpeakerOptions: OsFilter = {
property: 'hasSpeakers',
label: 'Speakers',
options: [
{ condition: true, label: this.translate.instant('Has speakers') },
{ condition: false, label: this.translate.instant('Has no speakers') }
]
};
public personalNoteFilterOptions = [
{
property: 'star',
@ -212,6 +221,11 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
this.tagFilterOptions
];
// only add the filter if the user has the correct permission
if (this.operator.hasPerms('agenda.can_see_list_of_speakers')) {
filterDefinitions.push(this.hasSpeakerOptions);
}
if (!this.operator.isAnonymous) {
filterDefinitions = filterDefinitions.concat(this.personalNoteFilterOptions);
}