mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Saving settings mode to cookies
This commit is contained in:
parent
2fa1c8f87f
commit
01f858b092
@ -1,4 +1,5 @@
|
|||||||
export class CookieNames {
|
export class CookieNames {
|
||||||
public static lang = 'pigallery2-lang';
|
public static lang = 'pigallery2-lang';
|
||||||
public static session = 'pigallery2-session';
|
public static session = 'pigallery2-session';
|
||||||
|
public static advancedSettings = 'advanced-settings';
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,8 @@
|
|||||||
i18n-switch-on-text
|
i18n-switch-on-text
|
||||||
switch-handle-width="100"
|
switch-handle-width="100"
|
||||||
switch-label-width="20"
|
switch-label-width="20"
|
||||||
[(ngModel)]="simplifiedMode">
|
[(ngModel)]="simplifiedMode"
|
||||||
|
(ngModelChange)="modeToggle()">
|
||||||
</bSwitch>
|
</bSwitch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,6 +7,8 @@ import {NavigationService} from '../../model/navigation.service';
|
|||||||
import {ISettingsComponent} from '../settings/_abstract/ISettingsComponent';
|
import {ISettingsComponent} from '../settings/_abstract/ISettingsComponent';
|
||||||
import {PageHelper} from '../../model/page.helper';
|
import {PageHelper} from '../../model/page.helper';
|
||||||
import {SettingsService} from '../settings/settings.service';
|
import {SettingsService} from '../settings/settings.service';
|
||||||
|
import {CookieNames} from '../../../../common/CookieNames';
|
||||||
|
import {CookieService} from 'ngx-cookie-service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-admin',
|
selector: 'app-admin',
|
||||||
@ -22,7 +24,11 @@ export class AdminComponent implements OnInit, AfterViewInit {
|
|||||||
constructor(private authService: AuthenticationService,
|
constructor(private authService: AuthenticationService,
|
||||||
private navigation: NavigationService,
|
private navigation: NavigationService,
|
||||||
public notificationService: NotificationService,
|
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 {
|
ngAfterViewInit(): void {
|
||||||
@ -55,6 +61,9 @@ export class AdminComponent implements OnInit, AfterViewInit {
|
|||||||
return 'info';
|
return 'info';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modeToggle(): void {
|
||||||
|
this.cookieService.set(CookieNames.advancedSettings, this.simplifiedMode ? 'false' : 'true');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user