Add option to hide amendments
Enables to hide amendments from the motion list Allows to search through amendment paragraphs in the list view of amendments
This commit is contained in:
parent
eaf4d8180d
commit
e7357a5b64
@ -338,10 +338,13 @@ export class ListViewTableComponent<V extends BaseViewModel, M extends BaseModel
|
|||||||
// custom filter predicates
|
// custom filter predicates
|
||||||
if (this.filterProps && this.filterProps.length) {
|
if (this.filterProps && this.filterProps.length) {
|
||||||
for (const prop of this.filterProps) {
|
for (const prop of this.filterProps) {
|
||||||
|
if (item[prop]) {
|
||||||
let propertyAsString = '';
|
let propertyAsString = '';
|
||||||
// If the property is a function, call it.
|
// If the property is a function, call it.
|
||||||
if (typeof item[prop] === 'function') {
|
if (typeof item[prop] === 'function') {
|
||||||
propertyAsString = '' + item[prop]();
|
propertyAsString = '' + item[prop]();
|
||||||
|
} else if (item[prop].constructor === Array) {
|
||||||
|
propertyAsString = item[prop].join('');
|
||||||
} else {
|
} else {
|
||||||
propertyAsString = '' + item[prop];
|
propertyAsString = '' + item[prop];
|
||||||
}
|
}
|
||||||
@ -360,6 +363,7 @@ export class ListViewTableComponent<V extends BaseViewModel, M extends BaseModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dataSource.setFilter(filterPredicate);
|
this.dataSource.setFilter(filterPredicate);
|
||||||
|
@ -62,7 +62,7 @@ export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> im
|
|||||||
/**
|
/**
|
||||||
* To filter stuff
|
* To filter stuff
|
||||||
*/
|
*/
|
||||||
public filterProps = ['submitters', 'title', 'identifier'];
|
public filterProps = ['submitters', 'title', 'identifier', 'amendment_paragraphs'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -39,6 +39,11 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
|
|||||||
*/
|
*/
|
||||||
private enabledWorkflows = { statuteEnabled: false, statute: null, motion: null };
|
private enabledWorkflows = { statuteEnabled: false, statute: null, motion: null };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine to show amendments in the motion list
|
||||||
|
*/
|
||||||
|
private showAmendmentsInMainTable: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter definitions for the workflow filter. Options will be generated by
|
* Filter definitions for the workflow filter. Options will be generated by
|
||||||
* getFilterOptions (as the workflows available may change)
|
* getFilterOptions (as the workflows available may change)
|
||||||
@ -136,6 +141,7 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
|
|||||||
) {
|
) {
|
||||||
super(store, OSStatus);
|
super(store, OSStatus);
|
||||||
this.getWorkflowConfig();
|
this.getWorkflowConfig();
|
||||||
|
this.getShowAmendmentConfig();
|
||||||
|
|
||||||
this.updateFilterForRepo(categoryRepo, this.categoryFilterOptions, this.translate.instant('No category set'));
|
this.updateFilterForRepo(categoryRepo, this.categoryFilterOptions, this.translate.instant('No category set'));
|
||||||
|
|
||||||
@ -155,6 +161,25 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
* @param motions The motions without amendments, if the according config was set
|
||||||
|
*/
|
||||||
|
protected preFilter(motions: ViewMotion[]): ViewMotion[] {
|
||||||
|
if (!this.showAmendmentsInMainTable) {
|
||||||
|
return motions.filter(motion => !motion.parent_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen to changes for the 'motions_amendments_main_table' config value
|
||||||
|
*/
|
||||||
|
private getShowAmendmentConfig(): void {
|
||||||
|
this.config.get<boolean>('motions_amendments_main_table').subscribe(show => {
|
||||||
|
this.showAmendmentsInMainTable = show;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private getWorkflowConfig(): void {
|
private getWorkflowConfig(): void {
|
||||||
this.config.get<string>('motions_statute_amendments_workflow').subscribe(id => {
|
this.config.get<string>('motions_statute_amendments_workflow').subscribe(id => {
|
||||||
this.enabledWorkflows.statute = +id;
|
this.enabledWorkflows.statute = +id;
|
||||||
|
Loading…
Reference in New Issue
Block a user