Merge pull request #4274 from MaximilianKrambach/smallchanges

various small fixes
This commit is contained in:
Maximilian Krambach 2019-02-08 13:17:53 +01:00 committed by GitHub
commit ab557486cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {
this.dataSource.filterPredicate = (data, filter) => {
filter = filter.toLowerCase();
if (!data || !data.information) {
return false;
}
filter = filter ? filter.toLowerCase() : '';
if (
this.getElementInfo(data)
.toLowerCase()
@ -164,7 +167,7 @@ export class HistoryListComponent extends ListViewBaseComponent<ViewHistory> imp
) {
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 (

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">
<span>{{ section.getTitle() }}</span>
</ng-container>
@ -13,26 +14,35 @@
<form [formGroup]="commentForms[section.id]" *ngIf="isCommentEdited(section)">
<!-- The HTML Editor -->
<h4 translate>Comment</h4>
<editor
formControlName='comment'
[init]="tinyMceSettings"
></editor>
<editor formControlName="comment" [init]="tinyMceSettings"></editor>
</form>
</ng-container>
<ng-container class="meta-text-block-action-row">
<button mat-icon-button *ngIf="!isCommentEdited(section)" (click)="editComment(section)"
matTooltip="{{ 'Edit' | translate }}">
<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 }}">
<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 }}">
<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>
</os-meta-text-block>
</div>

View File

@ -155,6 +155,19 @@ export class MotionCommentsComponent extends BaseViewComponent {
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.
*

View File

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

View File

@ -120,7 +120,7 @@ export class MotionMultiselectService {
id: motion.id,
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
});
}
@ -171,7 +171,7 @@ export class MotionMultiselectService {
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]) {
const requestData = motions.map(motion => {
const submitterIdsToRemove = selectedChoice.items as number[];
@ -181,7 +181,7 @@ export class MotionMultiselectService {
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
};
});
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]) {
const requestData = motions.map(motion => {
const tagIdsToRemove = selectedChoice.items as number[];
@ -213,7 +213,7 @@ export class MotionMultiselectService {
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]) {
const requestData = motions.map(motion => {
return {
@ -221,7 +221,7 @@ export class MotionMultiselectService {
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
* 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);
}
}
/**
* Handler for bulk setting new passwords. Needs multiSelect mode.