mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-13 18:17:02 +01:00
Save slimsidebar settings to db on change
This commit is contained in:
parent
d003d26a67
commit
617055fca7
2 changed files with 31 additions and 1 deletions
|
|
@ -24,6 +24,8 @@ import {
|
|||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { TasksService } from 'src/app/services/tasks.service'
|
||||
import { ComponentCanDeactivate } from 'src/app/guards/dirty-doc.guard'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-frame',
|
||||
|
|
@ -40,7 +42,8 @@ export class AppFrameComponent implements ComponentCanDeactivate {
|
|||
private remoteVersionService: RemoteVersionService,
|
||||
private list: DocumentListViewService,
|
||||
public settingsService: SettingsService,
|
||||
public tasksService: TasksService
|
||||
public tasksService: TasksService,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
this.remoteVersionService
|
||||
.checkForUpdates()
|
||||
|
|
@ -55,6 +58,27 @@ export class AppFrameComponent implements ComponentCanDeactivate {
|
|||
|
||||
isMenuCollapsed: boolean = true
|
||||
|
||||
get slimSidebarEnabled(): boolean {
|
||||
return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR)
|
||||
}
|
||||
|
||||
set slimSidebarEnabled(enabled: boolean) {
|
||||
console.log('set slimSidebarEnabled', enabled)
|
||||
|
||||
this.settingsService.set(SETTINGS_KEYS.SLIM_SIDEBAR, enabled)
|
||||
this.settingsService
|
||||
.storeSettings()
|
||||
.pipe(first())
|
||||
.subscribe({
|
||||
error: (error) => {
|
||||
this.toastService.showError(
|
||||
$localize`An error occurred while saving settings.`
|
||||
)
|
||||
console.log(error)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
closeMenu() {
|
||||
this.isMenuCollapsed = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue