Make entire screen dropzone on dashboard too

This commit is contained in:
shamoon 2023-09-23 16:12:01 -07:00
parent 787209d1e4
commit 9f4b8fcfed
4 changed files with 5 additions and 16 deletions

View File

@ -139,14 +139,6 @@ describe('AppComponent', () => {
expect(toastSpy).toHaveBeenCalled() expect(toastSpy).toHaveBeenCalled()
}) })
it('should disable drag-drop if on dashboard', () => {
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
jest.spyOn(router, 'url', 'get').mockReturnValueOnce('/dashboard')
expect(component.dragDropEnabled).toBeFalsy()
jest.spyOn(router, 'url', 'get').mockReturnValueOnce('/documents')
expect(component.dragDropEnabled).toBeTruthy()
})
it('should enable drag-drop if user has permissions', () => { it('should enable drag-drop if user has permissions', () => {
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true) jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
expect(component.dragDropEnabled).toBeTruthy() expect(component.dragDropEnabled).toBeTruthy()

View File

@ -252,12 +252,9 @@ export class AppComponent implements OnInit, OnDestroy {
} }
public get dragDropEnabled(): boolean { public get dragDropEnabled(): boolean {
return ( return this.permissionsService.currentUserCan(
!this.router.url.includes('dashboard') && PermissionAction.Add,
this.permissionsService.currentUserCan( PermissionType.Document
PermissionAction.Add,
PermissionType.Document
)
) )
} }

View File

@ -10,7 +10,7 @@
</div> </div>
<div content tourAnchor="tour.upload-widget" class="h-100"> <div content tourAnchor="tour.upload-widget" class="h-100">
<form class="h-100"> <form class="h-100">
<ngx-file-drop dropZoneLabel="Drop documents here or" browseBtnLabel="Browse files" (onFileDrop)="dropped($event)" <ngx-file-drop dropZoneLabel="Drop documents anywhere or" browseBtnLabel="Browse files" (onFileDrop)="dropped($event)"
(onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" dropZoneClassName="bg-light card h-100" (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" dropZoneClassName="bg-light card h-100"
multiple="true" contentClassName="justify-content-center d-flex flex-column text-muted align-items-center py-5 px-2 h-100" [showBrowseBtn]=true multiple="true" contentClassName="justify-content-center d-flex flex-column text-muted align-items-center py-5 px-2 h-100" [showBrowseBtn]=true
browseBtnClassName="btn btn-sm btn-outline-primary mt-2" i18n-dropZoneLabel i18n-browseBtnLabel> browseBtnClassName="btn btn-sm btn-outline-primary mt-2" i18n-dropZoneLabel i18n-browseBtnLabel>

View File

@ -1,4 +1,4 @@
<div class="card h-100 shadow-sm bg-light"> <div class="card shadow-sm bg-light">
<div class="card-header"> <div class="card-header">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<h6 class="card-title mb-0">{{title}}</h6> <h6 class="card-title mb-0">{{title}}</h6>