Compare commits

...
6 Commits
Author SHA1 Message Date
shamoon 87427a60a8 Try unintelligent patch 2025-03-25 10:56:34 -07:00
shamoon 7a07f1e81d Remove unnecessary check 2025-03-21 10:28:20 -07:00
shamoon 92524ae97a Chore: remove a couple of console logs 2025-03-21 10:24:59 -07:00
shamoon 1c89f6da24 More narrow device tweaks 2025-03-21 10:24:59 -07:00
shamoon d1a3e3b859 Fix: top nav layout with custom title on very narrow screens 2025-03-21 10:24:58 -07:00
shamoon 79ae594d54 Fix: fix saving docs with notes 2025-03-21 10:24:58 -07:00
8 changed files with 37 additions and 39 deletions
@@ -15,7 +15,7 @@
</svg>
<div class="ms-2 ms-md-3 d-inline-block" [class.d-md-none]="slimSidebarEnabled">
@if (customAppTitle?.length) {
<div class="d-flex flex-column align-items-start">
<div class="d-flex flex-column align-items-start custom-title">
<span class="title">{{customAppTitle}}</span>
<span class="byline text-uppercase font-monospace" i18n>by Paperless-ngx</span>
</div>
@@ -244,7 +244,7 @@ main {
}
}
@media screen and (max-width: 768px) {
@media screen and (min-width: 366px) and (max-width: 768px) {
.navbar-toggler {
// compensate for 2 buttons on the right
margin-right: 45px;
@@ -257,6 +257,13 @@ main {
}
}
@media screen and (max-width: 345px) {
.custom-title {
max-width: 110px;
overflow: hidden;
}
}
:host ::ng-deep .dropdown.show .dropdown-toggle,
:host ::ng-deep .dropdown-toggle:hover {
opacity: 0.7;
@@ -492,11 +492,9 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
component.selectionModel.items = items
component.selectionModel = selectionModel
component.selectionModel.intersection = Intersection.Include
console.log(component.selectionModel.items[0])
component.selectionModel.set(null, ToggleableItemState.Selected)
component.selectionModel.intersection = Intersection.Exclude
component.selectionModel.toggleIntersection()
console.log(component.selectionModel)
expect(component.selectionModel.getExcludedItems()).toEqual([
negativeNullItem,
])
@@ -451,11 +451,11 @@ describe('DocumentDetailComponent', () => {
initNormally()
component.title = 'Foo Bar'
const closeSpy = jest.spyOn(component, 'close')
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
const toastSpy = jest.spyOn(toastService, 'showInfo')
updateSpy.mockImplementation((o) => of(doc))
patchSpy.mockImplementation((o) => of(doc))
component.save(true)
expect(updateSpy).toHaveBeenCalled()
expect(patchSpy).toHaveBeenCalled()
expect(closeSpy).toHaveBeenCalled()
expect(toastSpy).toHaveBeenCalledWith(
'Document "Doc 3" saved successfully.'
@@ -466,11 +466,11 @@ describe('DocumentDetailComponent', () => {
initNormally()
component.title = 'Foo Bar'
const closeSpy = jest.spyOn(component, 'close')
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
const toastSpy = jest.spyOn(toastService, 'showInfo')
updateSpy.mockImplementation((o) => of(doc))
patchSpy.mockImplementation((o) => of(doc))
component.save()
expect(updateSpy).toHaveBeenCalled()
expect(patchSpy).toHaveBeenCalled()
expect(closeSpy).not.toHaveBeenCalled()
expect(toastSpy).toHaveBeenCalledWith(
'Document "Doc 3" saved successfully.'
@@ -482,12 +482,12 @@ describe('DocumentDetailComponent', () => {
initNormally()
component.title = 'Foo Bar'
const closeSpy = jest.spyOn(component, 'close')
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
const toastSpy = jest.spyOn(toastService, 'showError')
const error = new Error('failed to save')
updateSpy.mockImplementation(() => throwError(() => error))
patchSpy.mockImplementation(() => throwError(() => error))
component.save()
expect(updateSpy).toHaveBeenCalled()
expect(patchSpy).toHaveBeenCalled()
expect(closeSpy).not.toHaveBeenCalled()
expect(toastSpy).toHaveBeenCalledWith(
'Error saving document "Doc 3"',
@@ -500,13 +500,13 @@ describe('DocumentDetailComponent', () => {
initNormally()
component.title = 'Foo Bar'
const closeSpy = jest.spyOn(component, 'close')
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
const toastSpy = jest.spyOn(toastService, 'showInfo')
updateSpy.mockImplementation(() =>
patchSpy.mockImplementation(() =>
throwError(() => new Error('failed to save'))
)
component.save(true)
expect(updateSpy).toHaveBeenCalled()
expect(patchSpy).toHaveBeenCalled()
expect(closeSpy).toHaveBeenCalled()
expect(toastSpy).toHaveBeenCalledWith(
'Document "Doc 3" saved successfully.'
@@ -517,8 +517,8 @@ describe('DocumentDetailComponent', () => {
initNormally()
const nextDocId = 100
component.title = 'Foo Bar'
const updateSpy = jest.spyOn(documentService, 'update')
updateSpy.mockReturnValue(of(doc))
const patchSpy = jest.spyOn(documentService, 'patch')
patchSpy.mockReturnValue(of(doc))
const nextSpy = jest.spyOn(documentListViewService, 'getNext')
nextSpy.mockReturnValue(of(nextDocId))
const closeSpy = jest.spyOn(openDocumentsService, 'closeDocument')
@@ -526,7 +526,7 @@ describe('DocumentDetailComponent', () => {
const navigateSpy = jest.spyOn(router, 'navigate')
component.saveEditNext()
expect(updateSpy).toHaveBeenCalled()
expect(patchSpy).toHaveBeenCalled()
expect(navigateSpy).toHaveBeenCalledWith(['documents', nextDocId])
expect
})
@@ -536,12 +536,12 @@ describe('DocumentDetailComponent', () => {
initNormally()
component.title = 'Foo Bar'
const closeSpy = jest.spyOn(component, 'close')
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
const toastSpy = jest.spyOn(toastService, 'showError')
const error = new Error('failed to save')
updateSpy.mockImplementation(() => throwError(() => error))
patchSpy.mockImplementation(() => throwError(() => error))
component.saveEditNext()
expect(updateSpy).toHaveBeenCalled()
expect(patchSpy).toHaveBeenCalled()
expect(closeSpy).not.toHaveBeenCalled()
expect(toastSpy).toHaveBeenCalledWith('Error saving document', error)
})
@@ -965,10 +965,10 @@ describe('DocumentDetailComponent', () => {
expect(fixture.debugElement.nativeElement.textContent).toContain(
customFields[1].name
)
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
component.save(true)
expect(updateSpy.mock.lastCall[0].custom_fields).toHaveLength(2)
expect(updateSpy.mock.lastCall[0].custom_fields[1]).toEqual({
expect(patchSpy.mock.lastCall[0].custom_fields).toHaveLength(2)
expect(patchSpy.mock.lastCall[0].custom_fields[1]).toEqual({
field: customFields[1].id,
value: null,
})
@@ -985,9 +985,9 @@ describe('DocumentDetailComponent', () => {
expect(
fixture.debugElement.query(By.css('form')).nativeElement.textContent
).not.toContain('Field 1')
const updateSpy = jest.spyOn(documentService, 'update')
const patchSpy = jest.spyOn(documentService, 'patch')
component.save(true)
expect(updateSpy.mock.lastCall[0].custom_fields).toHaveLength(
expect(patchSpy.mock.lastCall[0].custom_fields).toHaveLength(
initialLength - 1
)
})
@@ -797,7 +797,7 @@ export class DocumentDetailComponent
this.networkActive = true
;(document.activeElement as HTMLElement)?.dispatchEvent(new Event('change'))
this.documentsService
.update(this.document)
.patch(this.document)
.pipe(first())
.subscribe({
next: (docValues) => {
@@ -825,10 +825,6 @@ export class DocumentDetailComponent
error: (error) => {
this.networkActive = false
const canEdit =
this.permissionsService.currentUserCan(
PermissionAction.Change,
PermissionType.Document
) &&
this.permissionsService.currentUserHasObjectPermissions(
PermissionAction.Change,
this.document
@@ -855,7 +851,7 @@ export class DocumentDetailComponent
this.networkActive = true
this.store.next(this.documentForm.value)
this.documentsService
.update(this.document)
.patch(this.document)
.pipe(
switchMap((updateResult) => {
return this.documentListViewService
@@ -602,7 +602,6 @@ export class SettingsService {
)
} catch (error) {
this.toastService.showError(errorMessage)
console.log(error)
}
this.storeSettings()
@@ -614,7 +613,6 @@ export class SettingsService {
},
error: (e) => {
this.toastService.showError(errorMessage)
console.log(e)
},
})
}
@@ -636,7 +634,6 @@ export class SettingsService {
this.toastService.showError(
'Error migrating update checking setting'
)
console.log(e)
},
})
}
+1 -1
View File
@@ -24,7 +24,7 @@
--pngx-bg-alt2: var(--bs-gray-200); // #e9ecef
--pngx-bg-disabled: #f7f7f7;
--pngx-focus-alpha: 0.3;
--pngx-toast-max-width: 360px;
--pngx-toast-max-width: 340px;
--bs-info: var(--pngx-bg-alt2);
--bs-info-rgb: 233, 236, 239;
@media screen and (min-width: 1024px) {
+2 -2
View File
@@ -870,7 +870,7 @@ class BasicUserSerializer(serializers.ModelSerializer):
class NotesSerializer(serializers.ModelSerializer):
user = BasicUserSerializer()
user = BasicUserSerializer(read_only=True)
class Meta:
model = Note
@@ -893,7 +893,7 @@ class DocumentSerializer(
created_date = serializers.DateField(required=False)
page_count = SerializerMethodField()
notes = NotesSerializer(many=True, required=False)
notes = NotesSerializer(many=True, required=False, read_only=True)
custom_fields = CustomFieldInstanceSerializer(
many=True,