diff --git a/src/common/CookieNames.ts b/src/common/CookieNames.ts index 53a98e43..fcb6d60c 100644 --- a/src/common/CookieNames.ts +++ b/src/common/CookieNames.ts @@ -1,4 +1,5 @@ export class CookieNames { public static lang = 'pigallery2-lang'; public static session = 'pigallery2-session'; + public static advancedSettings = 'advanced-settings'; } diff --git a/src/frontend/app/ui/admin/admin.component.html b/src/frontend/app/ui/admin/admin.component.html index 1ac9ae1a..eeafc388 100644 --- a/src/frontend/app/ui/admin/admin.component.html +++ b/src/frontend/app/ui/admin/admin.component.html @@ -62,7 +62,8 @@ i18n-switch-on-text switch-handle-width="100" switch-label-width="20" - [(ngModel)]="simplifiedMode"> + [(ngModel)]="simplifiedMode" + (ngModelChange)="modeToggle()"> diff --git a/src/frontend/app/ui/admin/admin.component.ts b/src/frontend/app/ui/admin/admin.component.ts index f3b16b24..f8ff9cfc 100644 --- a/src/frontend/app/ui/admin/admin.component.ts +++ b/src/frontend/app/ui/admin/admin.component.ts @@ -7,6 +7,8 @@ import {NavigationService} from '../../model/navigation.service'; import {ISettingsComponent} from '../settings/_abstract/ISettingsComponent'; import {PageHelper} from '../../model/page.helper'; import {SettingsService} from '../settings/settings.service'; +import {CookieNames} from '../../../../common/CookieNames'; +import {CookieService} from 'ngx-cookie-service'; @Component({ selector: 'app-admin', @@ -22,7 +24,11 @@ export class AdminComponent implements OnInit, AfterViewInit { constructor(private authService: AuthenticationService, private navigation: NavigationService, public notificationService: NotificationService, - public settingsService: SettingsService) { + public settingsService: SettingsService, + private cookieService: CookieService) { + if (this.cookieService.check(CookieNames.advancedSettings)) { + this.simplifiedMode = !(this.cookieService.get(CookieNames.advancedSettings) === 'true'); + } } ngAfterViewInit(): void { @@ -55,6 +61,9 @@ export class AdminComponent implements OnInit, AfterViewInit { return 'info'; } + modeToggle(): void { + this.cookieService.set(CookieNames.advancedSettings, this.simplifiedMode ? 'false' : 'true'); + } }