adjustable page size fixes #8

This commit is contained in:
Jonas Winkler
2020-11-04 19:28:08 +01:00
parent 3bc9c3842e
commit 259da406dd
6 changed files with 87 additions and 41 deletions

View File

@@ -1,5 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { SavedViewConfig } from 'src/app/data/saved-view-config';
import { GENERAL_SETTINGS } from 'src/app/data/storage-keys';
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
import { SavedViewConfigService } from 'src/app/services/saved-view-config.service';
@Component({
@@ -9,11 +12,14 @@ import { SavedViewConfigService } from 'src/app/services/saved-view-config.servi
})
export class SettingsComponent implements OnInit {
constructor(
private savedViewConfigService: SavedViewConfigService
) { }
settingsForm = new FormGroup({
'documentListItemPerPage': new FormControl(+localStorage.getItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE) || GENERAL_SETTINGS.DOCUMENT_LIST_SIZE_DEFAULT)
})
active
constructor(
private savedViewConfigService: SavedViewConfigService,
private documentListViewService: DocumentListViewService
) { }
ngOnInit(): void {
}
@@ -22,4 +28,8 @@ export class SettingsComponent implements OnInit {
this.savedViewConfigService.deleteConfig(config)
}
saveSettings() {
localStorage.setItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage)
this.documentListViewService.updatePageSize()
}
}