mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-06 01:38:01 +00:00
Fix: change share link bundle dialog button to close after create, don't toast on copied (#14002)
This commit is contained in:
+2
-1
@@ -64,7 +64,7 @@
|
||||
<dt class="col-sm-4" i18n>Slug</dt>
|
||||
<dd class="col-sm-8"><code>{{ createdBundle.slug }}</code></dd>
|
||||
<dt class="col-sm-4" i18n>Link</dt>
|
||||
<dd class="col-sm-8">
|
||||
<dd class="col-sm-8 position-relative">
|
||||
<label class="visually-hidden" for="shareBundleLink" i18n>Share link</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input id="shareBundleLink" class="form-control" type="text" [value]="getShareUrl(createdBundle)" readonly>
|
||||
@@ -82,6 +82,7 @@
|
||||
<span class="visually-hidden" i18n>Copy link</span>
|
||||
</button>
|
||||
</div>
|
||||
<span class="badge bg-primary fade position-absolute top-50 end-0 translate-middle-y me-5 pe-none z-3" [class.show]="copied()" i18n>Copied!</span>
|
||||
</dd>
|
||||
<dt class="col-sm-4" i18n>Documents</dt>
|
||||
<dd class="col-sm-8">{{ createdBundle.document_count }}</dd>
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ describe('ShareLinkBundleDialogComponent', () => {
|
||||
|
||||
expect(copySpy).toHaveBeenCalledWith(component.getShareUrl(bundle))
|
||||
expect(component.copied()).toBe(true)
|
||||
expect(toastService.showInfo).toHaveBeenCalled()
|
||||
expect(toastService.showInfo).not.toHaveBeenCalled()
|
||||
|
||||
jest.advanceTimersByTime(3000)
|
||||
expect(component.copied()).toBe(false)
|
||||
|
||||
+1
-3
@@ -17,7 +17,6 @@ import {
|
||||
} from 'src/app/data/share-link-bundle'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { FileSizePipe } from 'src/app/pipes/file-size.pipe'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { ConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.component'
|
||||
|
||||
@@ -36,7 +35,6 @@ import { ConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.compone
|
||||
export class ShareLinkBundleDialogComponent extends ConfirmDialogComponent {
|
||||
private readonly formBuilder = inject(FormBuilder)
|
||||
private readonly clipboard = inject(Clipboard)
|
||||
private readonly toastService = inject(ToastService)
|
||||
|
||||
readonly documents = signal<Document[]>([])
|
||||
readonly selectionCount = signal(0)
|
||||
@@ -80,6 +78,7 @@ export class ShareLinkBundleDialogComponent extends ConfirmDialogComponent {
|
||||
}
|
||||
this.buttonsEnabled.set(false)
|
||||
super.confirm()
|
||||
this.cancelBtnCaption = $localize`Close`
|
||||
}
|
||||
|
||||
getShareUrl(bundle: ShareLinkBundleSummary): string {
|
||||
@@ -93,7 +92,6 @@ export class ShareLinkBundleDialogComponent extends ConfirmDialogComponent {
|
||||
const success = this.clipboard.copy(this.getShareUrl(bundle))
|
||||
if (success) {
|
||||
this.copied.set(true)
|
||||
this.toastService.showInfo($localize`Share link copied to clipboard.`)
|
||||
setTimeout(() => {
|
||||
this.copied.set(false)
|
||||
}, 3000)
|
||||
|
||||
Reference in New Issue
Block a user