Make zen mode activation stick using a static variable

pull/5366/head
Wieland Lindenthal 8 years ago
parent fc4d4f9761
commit e0599b8ba7
  1. 10
      frontend/app/components/wp-buttons/wp-zen-mode-toggle-button/wp-zen-mode-toggle-button.directive.ts

@ -33,7 +33,7 @@ export class WorkPackageZenModeButtonController extends WorkPackageButtonControl
public buttonId:string = 'work-packages-zen-mode-toggle-button';
public iconClass:string = 'icon-zen-mode';
public inZenMode:boolean = false;
static inZenMode:boolean = false;
private activateLabel:string;
private deactivateLabel:string;
@ -58,17 +58,17 @@ export class WorkPackageZenModeButtonController extends WorkPackageButtonControl
}
public isActive():boolean {
return this.inZenMode;
return WorkPackageZenModeButtonController.inZenMode;
}
public performAction() {
if (this.inZenMode) {
if (WorkPackageZenModeButtonController.inZenMode) {
// deactivate Zen Mode
this.inZenMode = false;
WorkPackageZenModeButtonController.inZenMode = false;
angular.element('body').removeClass('zen-mode');
} else {
// activate Zen Mode
this.inZenMode = true;
WorkPackageZenModeButtonController.inZenMode = true;
angular.element('body').addClass('zen-mode');
}
}

Loading…
Cancel
Save