Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Merge remote-tracking branch 'upstream/dev' into feature/dark-mode

Michael Shamoon2e0d36c4d964
diff --cc src-ui/src/app/components/manage/settings/settings.component.html
index 9b999c0dc,1f5374dba..d15c7fe2b
--- a/src-ui/src/app/components/manage/settings/settings.component.html
+++ b/src-ui/src/app/components/manage/settings/settings.component.html
@@@ -24,23 -24,17 +24,30 @@@
<option [ngValue]="50">50</option>
<option [ngValue]="100">100</option>
</select>
-
+
+ </div>
+ </div>
+
+ <div class="form-row form-group">
+ <div class="col-md-3 col-form-label">
+ <span i18n>Dark mode</span>
+ </div>
+ <div class="col">
+ <app-input-check i18n-title title="Use system settings" formControlName="darkModeUseSystem" (change)="toggleDarkModeSetting()"></app-input-check>
+ <div class="custom-control custom-switch" *ngIf="!settingsForm.value.darkModeUseSystem">
+ <input type="checkbox" class="custom-control-input" id="darkModeEnabled" formControlName="darkModeEnabled" [checked]="settingsForm.value.darkModeEnabled">
+ <label class="custom-control-label" for="darkModeEnabled">Enabled</label>
+ </div>
</div>
+
+
</div>
+ <h4 i18n>Bulk editing</h4>
+
+ <app-input-check i18n-title title="Show confirmation dialogs" formControlName="bulkEditConfirmationDialogs" i18n-hint hint="Deleting documents will always ask for confirmation."></app-input-check>
+ <app-input-check i18n-title title="Apply on close" formControlName="bulkEditApplyOnClose"></app-input-check>
+
</ng-template>
</li>
<li [ngbNavItem]="2">
diff --cc src-ui/src/app/components/manage/settings/settings.component.ts
index a514658fb,c26c63384..df3015e21
--- a/src-ui/src/app/components/manage/settings/settings.component.ts
+++ b/src-ui/src/app/components/manage/settings/settings.component.ts
@@@ -1,11 -1,10 +1,11 @@@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Renderer2 } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view';
- import { GENERAL_SETTINGS } from 'src/app/data/storage-keys';
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
import { SavedViewService } from 'src/app/services/rest/saved-view.service';
+ import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
import { ToastService } from 'src/app/services/toast.service';
+import { AppViewService } from 'src/app/services/app-view.service';
@Component({
selector: 'app-settings',
@@@ -17,13 -16,9 +17,11 @@@ export class SettingsComponent implemen
savedViewGroup = new FormGroup({})
settingsForm = new FormGroup({
- 'documentListItemPerPage': new FormControl(+localStorage.getItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE) || GENERAL_SETTINGS.DOCUMENT_LIST_SIZE_DEFAULT),
- 'darkModeUseSystem': new FormControl(
- localStorage.getItem(GENERAL_SETTINGS.DARK_MODE_USE_SYSTEM) == undefined ? GENERAL_SETTINGS.DARK_MODE_USE_SYSTEM_DEFAULT : JSON.parse(localStorage.getItem(GENERAL_SETTINGS.DARK_MODE_USE_SYSTEM))
- ),
- 'darkModeEnabled': new FormControl(
- localStorage.getItem(GENERAL_SETTINGS.DARK_MODE_ENABLED) == undefined ? GENERAL_SETTINGS.DARK_MODE_ENABLED_DEFAULT : JSON.parse(localStorage.getItem(GENERAL_SETTINGS.DARK_MODE_ENABLED))
- ),
+ 'bulkEditConfirmationDialogs': new FormControl(this.settings.get(SETTINGS_KEYS.BULK_EDIT_CONFIRMATION_DIALOGS)),
+ 'bulkEditApplyOnClose': new FormControl(this.settings.get(SETTINGS_KEYS.BULK_EDIT_APPLY_ON_CLOSE)),
+ 'documentListItemPerPage': new FormControl(this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE)),
++ 'darkModeUseSystem': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_USE_SYSTEM)),
++ 'darkModeEnabled': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_ENABLED)),
'savedViews': this.savedViewGroup
})
@@@ -33,9 -26,11 +31,10 @@@
public savedViewService: SavedViewService,
private documentListViewService: DocumentListViewService,
private toastService: ToastService,
- private settings: SettingsService
++ private settings: SettingsService,
+ private appViewService: AppViewService
) { }
- savedViews: PaperlessSavedView[]
-
ngOnInit() {
this.savedViewService.listAll().subscribe(r => {
this.savedViews = r.results
@@@ -58,20 -53,11 +57,22 @@@
})
}
+ toggleDarkModeSetting() {
+ if (this.settingsForm.value.darkModeUseSystem) {
+ (this.settingsForm.controls.darkModeEnabled as FormControl).disable()
+ } else {
+ (this.settingsForm.controls.darkModeEnabled as FormControl).enable()
+ }
+ }
+
private saveLocalSettings() {
- localStorage.setItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage)
- localStorage.setItem(GENERAL_SETTINGS.DARK_MODE_USE_SYSTEM, this.settingsForm.value.darkModeUseSystem)
- localStorage.setItem(GENERAL_SETTINGS.DARK_MODE_ENABLED, (this.settingsForm.value.darkModeEnabled == true).toString())
+ this.settings.set(SETTINGS_KEYS.BULK_EDIT_APPLY_ON_CLOSE, this.settingsForm.value.bulkEditApplyOnClose)
+ this.settings.set(SETTINGS_KEYS.BULK_EDIT_CONFIRMATION_DIALOGS, this.settingsForm.value.bulkEditConfirmationDialogs)
+ this.settings.set(SETTINGS_KEYS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage)
++ this.settings.set(SETTINGS_KEYS.DARK_MODE_USE_SYSTEM, this.settingsForm.value.darkModeUseSystem)
++ this.settings.set(SETTINGS_KEYS.DARK_MODE_ENABLED, (this.settingsForm.value.darkModeEnabled == true).toString())
this.documentListViewService.updatePageSize()
+ this.appViewService.updateDarkModeSettings()
this.toastService.showInfo($localize`Settings saved successfully.`)
}