disable multiselect options if nothing selected

This commit is contained in:
Maximilian Krambach 2019-04-12 13:57:22 +02:00
parent 2bd9172006
commit 48593acc25
5 changed files with 52 additions and 25 deletions

View File

@ -169,20 +169,20 @@
</button> </button>
<!-- Deselect all --> <!-- Deselect all -->
<button mat-menu-item (click)="deselectAll()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="deselectAll()">
<mat-icon>clear</mat-icon> <mat-icon>clear</mat-icon>
<span translate>Deselect all</span> <span translate>Deselect all</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div *osPerms="'agenda.can_manage'"> <div *osPerms="'agenda.can_manage'">
<!-- Close selected --> <!-- Close selected -->
<button mat-menu-item (click)="setClosedSelected(true)"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setClosedSelected(true)">
<mat-icon>done</mat-icon> <mat-icon>done</mat-icon>
<span translate>Close</span> <span translate>Close</span>
</button> </button>
<!-- Open selected --> <!-- Open selected -->
<button mat-menu-item (click)="setClosedSelected(false)"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setClosedSelected(false)">
<mat-icon>redo</mat-icon> <mat-icon>redo</mat-icon>
<span translate>Open</span> <span translate>Open</span>
</button> </button>
@ -190,26 +190,26 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<!-- Set multiple to public --> <!-- Set multiple to public -->
<button mat-menu-item (click)="setAgendaType(1)"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setAgendaType(1)">
<mat-icon>public</mat-icon> <mat-icon>public</mat-icon>
<span translate>Set public</span> <span translate>Set public</span>
</button> </button>
<!-- Set multiple to internal --> <!-- Set multiple to internal -->
<button mat-menu-item (click)="setAgendaType(2)"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setAgendaType(2)">
<mat-icon>visibility</mat-icon> <mat-icon>visibility</mat-icon>
<span translate>Set internal</span> <span translate>Set internal</span>
</button> </button>
<!-- Set multiple to hidden --> <!-- Set multiple to hidden -->
<button mat-menu-item (click)="setAgendaType(3)"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setAgendaType(3)">
<mat-icon>visibility_off</mat-icon> <mat-icon>visibility_off</mat-icon>
<span translate>Set hidden</span> <span translate>Set hidden</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<!-- Delete selected --> <!-- Delete selected -->
<button mat-menu-item class="red-warning-text" (click)="deleteSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" class="red-warning-text" (click)="deleteSelected()">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span translate>Delete</span> <span translate>Delete</span>
</button> </button>

View File

@ -95,7 +95,7 @@
<mat-icon>done_all</mat-icon> <mat-icon>done_all</mat-icon>
<span translate>Select all</span> <span translate>Select all</span>
</button> </button>
<button mat-menu-item (click)="deselectAll()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="deselectAll()">
<mat-icon>clear</mat-icon> <mat-icon>clear</mat-icon>
<span translate>Deselect all</span> <span translate>Deselect all</span>
</button> </button>
@ -104,6 +104,7 @@
mat-menu-item mat-menu-item
class="red-warning-text" class="red-warning-text"
*osPerms="'assignment.can_manage'" *osPerms="'assignment.can_manage'"
[disabled]="!selectedRows.length"
(click)="deleteSelected()" (click)="deleteSelected()"
> >
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>

View File

@ -196,12 +196,17 @@
<mat-icon>done_all</mat-icon> <mat-icon>done_all</mat-icon>
<span translate>Select all</span> <span translate>Select all</span>
</button> </button>
<button mat-menu-item (click)="deselectAll()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="deselectAll()">
<mat-icon>clear</mat-icon> <mat-icon>clear</mat-icon>
<span translate>Deselect all</span> <span translate>Deselect all</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item *osPerms="'mediafiles.can_manage'" (click)="deleteSelected()"> <button
mat-menu-item
*osPerms="'mediafiles.can_manage'"
[disabled]="!selectedRows.length"
(click)="deleteSelected()"
>
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span translate>Delete</span> <span translate>Delete</span>
</button> </button>

View File

@ -215,22 +215,23 @@
<mat-icon>done_all</mat-icon> <mat-icon>done_all</mat-icon>
<span translate>Select all</span> <span translate>Select all</span>
</button> </button>
<button mat-menu-item (click)="deselectAll()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="deselectAll()">
<mat-icon>clear</mat-icon> <mat-icon>clear</mat-icon>
<span translate>Deselect all</span> <span translate>Deselect all</span>
</button> </button>
<div *ngIf="perms.isAllowed('change_metadata')"> <div *ngIf="perms.isAllowed('change_metadata')">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="multiselectWrapper(multiselectService.bulkToggleFavorite(selectedRows))"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="multiselectWrapper(multiselectService.bulkSetFavorite(selectedRows))">
<mat-icon>star</mat-icon> <mat-icon>star</mat-icon>
<span translate>Set/unset Favorite</span> <span translate>Set/unset Favorite</span>
</button> </button>
<button mat-menu-item (click)="multiselectWrapper(multiselectService.setStateOfMultiple(selectedRows))"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="multiselectWrapper(multiselectService.setStateOfMultiple(selectedRows))">
<mat-icon>label</mat-icon> <mat-icon>label</mat-icon>
<span translate>Set status</span> <span translate>Set status</span>
</button> </button>
<button <button
*ngIf="recomendationEnabled" *ngIf="recomendationEnabled"
[disabled]="!selectedRows.length"
mat-menu-item mat-menu-item
(click)="multiselectWrapper(multiselectService.setRecommendation(selectedRows))" (click)="multiselectWrapper(multiselectService.setRecommendation(selectedRows))"
> >
@ -240,6 +241,7 @@
</button> </button>
<button <button
mat-menu-item mat-menu-item
[disabled]="!selectedRows.length"
*ngIf="categories.length" *ngIf="categories.length"
(click)="multiselectWrapper(multiselectService.setCategory(selectedRows))" (click)="multiselectWrapper(multiselectService.setCategory(selectedRows))"
> >
@ -250,6 +252,7 @@
<button <button
mat-menu-item mat-menu-item
*ngIf="motionBlocks.length" *ngIf="motionBlocks.length"
[disabled]="!selectedRows.length"
(click)="multiselectWrapper(multiselectService.setMotionBlock(selectedRows))" (click)="multiselectWrapper(multiselectService.setMotionBlock(selectedRows))"
> >
<mat-icon>widgets</mat-icon> <mat-icon>widgets</mat-icon>
@ -257,7 +260,9 @@
<span translate>Set motion block</span> <span translate>Set motion block</span>
</button> </button>
<button mat-menu-item (click)="multiselectWrapper(multiselectService.changeSubmitters(selectedRows))"> <button mat-menu-item
[disabled]="!selectedRows.length"
(click)="multiselectWrapper(multiselectService.changeSubmitters(selectedRows))">
<mat-icon>person_add</mat-icon> <mat-icon>person_add</mat-icon>
<!-- TODO: icon --> <!-- TODO: icon -->
<span translate>Add/remove submitters</span> <span translate>Add/remove submitters</span>
@ -265,17 +270,22 @@
<button <button
mat-menu-item mat-menu-item
*ngIf="tags.length" *ngIf="tags.length"
[disabled]="!selectedRows.length"
(click)="multiselectWrapper(multiselectService.changeTags(selectedRows))" (click)="multiselectWrapper(multiselectService.changeTags(selectedRows))"
> >
<mat-icon>bookmarks</mat-icon> <mat-icon>bookmarks</mat-icon>
<!-- TODO: icon --> <!-- TODO: icon -->
<span translate>Add/remove tags</span> <span translate>Add/remove tags</span>
</button> </button>
<button mat-menu-item (click)="multiselectWrapper(multiselectService.moveToItem(selectedRows))"> <button mat-menu-item
[disabled]="!selectedRows.length"
(click)="multiselectWrapper(multiselectService.moveToItem(selectedRows))">
<mat-icon>sort</mat-icon> <mat-icon>sort</mat-icon>
<span translate>Move to agenda item</span> <span translate>Move to agenda item</span>
</button> </button>
<button mat-menu-item (click)="multiselectWrapper(multiselectService.bulkMoveItems(selectedRows))"> <button mat-menu-item
[disabled]="!selectedRows.length"
(click)="multiselectWrapper(multiselectService.bulkMoveItems(selectedRows))">
<mat-icon>format_indent_increase</mat-icon> <mat-icon>format_indent_increase</mat-icon>
<span translate>Move in call list</span> <span translate>Move in call list</span>
</button> </button>
@ -285,6 +295,7 @@
<button <button
mat-menu-item mat-menu-item
class="red-warning-text" class="red-warning-text"
[disabled]="!selectedRows.length"
(click)="multiselectService.delete(selectedRows); toggleMultiSelect()" (click)="multiselectService.delete(selectedRows); toggleMultiSelect()"
> >
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>

View File

@ -152,20 +152,25 @@
<span translate>Select all</span> <span translate>Select all</span>
</button> </button>
<button mat-menu-item (click)="deselectAll()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="deselectAll()">
<mat-icon>clear</mat-icon> <mat-icon>clear</mat-icon>
<span translate>Deselect all</span> <span translate>Deselect all</span>
</button> </button>
<div *osPerms="'users.can_manage'"> <div *osPerms="'users.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="setGroupSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setGroupSelected()">
<mat-icon>people</mat-icon> <mat-icon>people</mat-icon>
<span translate>Add/remove groups ...</span> <span translate>Add/remove groups ...</span>
</button> </button>
<div *ngIf="presenceViewConfigured"> <div *ngIf="presenceViewConfigured">
<button mat-menu-item *osPerms="'users.can_manage'" routerLink="presence"> <button
mat-menu-item
*osPerms="'users.can_manage'"
[disabled]="!selectedRows.length"
routerLink="presence"
>
<mat-icon>transfer_within_a_station</mat-icon> <mat-icon>transfer_within_a_station</mat-icon>
<span translate>Presence</span> <span translate>Presence</span>
</button> </button>
@ -179,34 +184,39 @@
<div *osPerms="'users.can_manage'"> <div *osPerms="'users.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="setActiveSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setActiveSelected()">
<mat-icon>block</mat-icon> <mat-icon>block</mat-icon>
<span translate>Enable/disable account ...</span> <span translate>Enable/disable account ...</span>
</button> </button>
<button mat-menu-item (click)="setPresentSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setPresentSelected()">
<mat-icon>check_box</mat-icon> <mat-icon>check_box</mat-icon>
<span translate>Set presence ...</span> <span translate>Set presence ...</span>
</button> </button>
<button mat-menu-item (click)="setCommitteeSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="setCommitteeSelected()">
<mat-icon>account_balance</mat-icon> <mat-icon>account_balance</mat-icon>
<span translate>Set committee ...</span> <span translate>Set committee ...</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="sendInvitationEmailSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="sendInvitationEmailSelected()">
<mat-icon>mail</mat-icon> <mat-icon>mail</mat-icon>
<span translate>Send invitation email</span> <span translate>Send invitation email</span>
</button> </button>
<button mat-menu-item (click)="resetPasswordsSelected()"> <button mat-menu-item [disabled]="!selectedRows.length" (click)="resetPasswordsSelected()">
<mat-icon>vpn_key</mat-icon> <mat-icon>vpn_key</mat-icon>
<span translate>Generate new passwords</span> <span translate>Generate new passwords</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item class="red-warning-text" (click)="deleteSelected()"> <button
mat-menu-item
class="red-warning-text"
[disabled]="!selectedRows.length"
(click)="deleteSelected()"
>
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span translate>Delete</span> <span translate>Delete</span>
</button> </button>