small fixes

- motion detail comments not always visible
- fix tag/recommendation multiselect
- fix display of prefixed categories in filter/dialogs
- confirm dialog on email invitation
- attempt at fixing history filter
This commit is contained in:
Maximilian Krambach 2019-02-07 11:46:19 +01:00
parent 268403cc92
commit 799d11cd17
6 changed files with 77 additions and 46 deletions

View File

@ -156,7 +156,10 @@ export class HistoryListComponent extends ListViewBaseComponent<ViewHistory> imp
*/ */
private setFilters(): void { private setFilters(): void {
this.dataSource.filterPredicate = (data, filter) => { this.dataSource.filterPredicate = (data, filter) => {
filter = filter.toLowerCase(); if (!data || !data.information) {
return false;
}
filter = filter ? filter.toLowerCase() : '';
if ( if (
this.getElementInfo(data) this.getElementInfo(data)
.toLowerCase() .toLowerCase()
@ -164,7 +167,7 @@ export class HistoryListComponent extends ListViewBaseComponent<ViewHistory> imp
) { ) {
return true; return true;
} }
if (data.user.full_name.toLowerCase().indexOf(filter) >= 0) { if (data.user && data.user.full_name.toLowerCase().indexOf(filter) >= 0) {
return true; return true;
} }
return ( return (

View File

@ -1,4 +1,5 @@
<os-meta-text-block *ngFor="let section of sections" [showActionRow]="canEditSection(section)" icon="comment"> <div class="text-warning" *ngFor="let section of sections">
<os-meta-text-block *ngIf="sectionVisible(section)" [showActionRow]="canEditSection(section)" icon="comment">
<ng-container class="meta-text-block-title"> <ng-container class="meta-text-block-title">
<span>{{ section.getTitle() }}</span> <span>{{ section.getTitle() }}</span>
</ng-container> </ng-container>
@ -13,26 +14,35 @@
<form [formGroup]="commentForms[section.id]" *ngIf="isCommentEdited(section)"> <form [formGroup]="commentForms[section.id]" *ngIf="isCommentEdited(section)">
<!-- The HTML Editor --> <!-- The HTML Editor -->
<h4 translate>Comment</h4> <h4 translate>Comment</h4>
<editor <editor formControlName="comment" [init]="tinyMceSettings"></editor>
formControlName='comment'
[init]="tinyMceSettings"
></editor>
</form> </form>
</ng-container> </ng-container>
<ng-container class="meta-text-block-action-row"> <ng-container class="meta-text-block-action-row">
<button mat-icon-button *ngIf="!isCommentEdited(section)" (click)="editComment(section)" <button
matTooltip="{{ 'Edit' | translate }}"> mat-icon-button
*ngIf="!isCommentEdited(section)"
(click)="editComment(section)"
matTooltip="{{ 'Edit' | translate }}"
>
<mat-icon>edit</mat-icon> <mat-icon>edit</mat-icon>
</button> </button>
<button mat-icon-button *ngIf="isCommentEdited(section)" (click)="saveComment(section)" <button
matTooltip="{{ 'Save' | translate }}"> mat-icon-button
*ngIf="isCommentEdited(section)"
(click)="saveComment(section)"
matTooltip="{{ 'Save' | translate }}"
>
<mat-icon>save</mat-icon> <mat-icon>save</mat-icon>
</button> </button>
<button mat-icon-button *ngIf="isCommentEdited(section)" (click)="cancelEditing(section)" <button
matTooltip="{{ 'Cancel edit' | translate }}"> mat-icon-button
*ngIf="isCommentEdited(section)"
(click)="cancelEditing(section)"
matTooltip="{{ 'Cancel edit' | translate }}"
>
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</ng-container> </ng-container>
</os-meta-text-block> </os-meta-text-block>
</div>

View File

@ -155,6 +155,19 @@ export class MotionCommentsComponent extends BaseViewComponent {
delete this.commentForms[section.id]; delete this.commentForms[section.id];
} }
/**
* Check if a section is visible at all
*
* @param section
* @returns true if there is any content or the user is allowed to edit
*/
public sectionVisible(section: ViewMotionCommentSection): boolean {
if (!this.canEditSection(section) && (!this.comments[section.id] || !this.comments[section.id].comment)) {
return false;
}
return true;
}
/** /**
* Returns true, if the comment is edited. * Returns true, if the comment is edited.
* *

View File

@ -62,7 +62,7 @@
<mat-icon>attach_file</mat-icon> <mat-icon>attach_file</mat-icon>
</span> </span>
<!-- title --> <!-- title -->
<span class="motion-list-title" matTooltip="{{ motion.title }}"> <span class="motion-list-title">
{{ motion.title }} {{ motion.title }}
</span> </span>
<!-- favorite icon --> <!-- favorite icon -->

View File

@ -120,7 +120,7 @@ export class MotionMultiselectService {
id: motion.id, id: motion.id,
recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number) recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number)
})); }));
await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation', { await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation/', {
motions: requestData motions: requestData
}); });
} }
@ -171,7 +171,7 @@ export class MotionMultiselectService {
submitters: submitterIds submitters: submitterIds
}; };
}); });
await this.httpService.post('/rest/motions/motion/manage_multiple_submitters', { motions: requestData }); await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
} else if (selectedChoice && selectedChoice.action === choices[1]) { } else if (selectedChoice && selectedChoice.action === choices[1]) {
const requestData = motions.map(motion => { const requestData = motions.map(motion => {
const submitterIdsToRemove = selectedChoice.items as number[]; const submitterIdsToRemove = selectedChoice.items as number[];
@ -181,7 +181,7 @@ export class MotionMultiselectService {
submitters: submitterIds submitters: submitterIds
}; };
}); });
await this.httpService.post('/rest/motions/motion/manage_multiple_submitters', { motions: requestData }); await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
} }
} }
@ -203,7 +203,7 @@ export class MotionMultiselectService {
tags: tagIds tags: tagIds
}; };
}); });
await this.httpService.post('/rest/motions/motion/manage_multiple_tags', { motions: requestData }); await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
} else if (selectedChoice && selectedChoice.action === choices[1]) { } else if (selectedChoice && selectedChoice.action === choices[1]) {
const requestData = motions.map(motion => { const requestData = motions.map(motion => {
const tagIdsToRemove = selectedChoice.items as number[]; const tagIdsToRemove = selectedChoice.items as number[];
@ -213,7 +213,7 @@ export class MotionMultiselectService {
tags: tagIds tags: tagIds
}; };
}); });
await this.httpService.post('/rest/motions/motion/manage_multiple_tags', { motions: requestData }); await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
} else if (selectedChoice && selectedChoice.action === choices[2]) { } else if (selectedChoice && selectedChoice.action === choices[2]) {
const requestData = motions.map(motion => { const requestData = motions.map(motion => {
return { return {
@ -221,7 +221,7 @@ export class MotionMultiselectService {
tags: [] tags: []
}; };
}); });
await this.httpService.post('/rest/motions/motion/manage_multiple_tags', { motions: requestData }); await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
} }
} }

View File

@ -258,9 +258,14 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser> implement
* Handler for bulk sending e-mail invitations. Uses selectedRows defined via * Handler for bulk sending e-mail invitations. Uses selectedRows defined via
* multiSelect mode. * multiSelect mode.
*/ */
public sendInvitationEmailSelected(): void { public async sendInvitationEmailSelected(): Promise<void> {
const content =
this.translate.instant('Send invitation e-Mails to the selected users?') +
` (${this.selectedRows.length} E-Mails)`;
if (await this.promptService.open('Are you sure?', content)) {
this.repo.sendInvitationEmail(this.selectedRows).then(this.raiseError, this.raiseError); this.repo.sendInvitationEmail(this.selectedRows).then(this.raiseError, this.raiseError);
} }
}
/** /**
* Handler for bulk setting new passwords. Needs multiSelect mode. * Handler for bulk setting new passwords. Needs multiSelect mode.