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,38 +1,48 @@
<os-meta-text-block *ngFor="let section of sections" [showActionRow]="canEditSection(section)" icon="comment"> <div class="text-warning" *ngFor="let section of sections">
<ng-container class="meta-text-block-title"> <os-meta-text-block *ngIf="sectionVisible(section)" [showActionRow]="canEditSection(section)" icon="comment">
<span>{{ section.getTitle() }}</span> <ng-container class="meta-text-block-title">
</ng-container> <span>{{ section.getTitle() }}</span>
<ng-container class="meta-text-block-content">
<ng-container *ngIf="!isCommentEdited(section)">
<div *ngIf="comments[section.id]" [innerHTML]="comments[section.id].comment"></div>
<div class="no-content" *ngIf="!comments[section.id] || !comments[section.id].comment" translate>
No comment
</div>
</ng-container> </ng-container>
<form [formGroup]="commentForms[section.id]" *ngIf="isCommentEdited(section)">
<!-- The HTML Editor -->
<h4 translate>Comment</h4>
<editor
formControlName='comment'
[init]="tinyMceSettings"
></editor>
</form>
</ng-container>
<ng-container class="meta-text-block-action-row"> <ng-container class="meta-text-block-content">
<button mat-icon-button *ngIf="!isCommentEdited(section)" (click)="editComment(section)" <ng-container *ngIf="!isCommentEdited(section)">
matTooltip="{{ 'Edit' | translate }}"> <div *ngIf="comments[section.id]" [innerHTML]="comments[section.id].comment"></div>
<mat-icon>edit</mat-icon> <div class="no-content" *ngIf="!comments[section.id] || !comments[section.id].comment" translate>
</button> No comment
<button mat-icon-button *ngIf="isCommentEdited(section)" (click)="saveComment(section)" </div>
matTooltip="{{ 'Save' | translate }}"> </ng-container>
<mat-icon>save</mat-icon> <form [formGroup]="commentForms[section.id]" *ngIf="isCommentEdited(section)">
</button> <!-- The HTML Editor -->
<button mat-icon-button *ngIf="isCommentEdited(section)" (click)="cancelEditing(section)" <h4 translate>Comment</h4>
matTooltip="{{ 'Cancel edit' | translate }}"> <editor formControlName="comment" [init]="tinyMceSettings"></editor>
<mat-icon>close</mat-icon> </form>
</button> </ng-container>
</ng-container>
</os-meta-text-block>
<ng-container class="meta-text-block-action-row">
<button
mat-icon-button
*ngIf="!isCommentEdited(section)"
(click)="editComment(section)"
matTooltip="{{ 'Edit' | translate }}"
>
<mat-icon>edit</mat-icon>
</button>
<button
mat-icon-button
*ngIf="isCommentEdited(section)"
(click)="saveComment(section)"
matTooltip="{{ 'Save' | translate }}"
>
<mat-icon>save</mat-icon>
</button>
<button
mat-icon-button
*ngIf="isCommentEdited(section)"
(click)="cancelEditing(section)"
matTooltip="{{ 'Cancel edit' | translate }}"
>
<mat-icon>close</mat-icon>
</button>
</ng-container>
</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,8 +258,13 @@ 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> {
this.repo.sendInvitationEmail(this.selectedRows).then(this.raiseError, this.raiseError); 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);
}
} }
/** /**