Skip to content

Commit

Permalink
Iris: Fix enable/disable settings buttons to show correct state to in…
Browse files Browse the repository at this point in the history
…structors (#8071)
  • Loading branch information
rstief authored Feb 24, 2024
1 parent 21b809d commit 4b1f709
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,10 @@
}
}
<div class="btn-group">
<div
class="btn"
[ngClass]="{ 'btn-success selected': !isChatSettingsSwitchDisabled && enabled, 'btn-default': isChatSettingsSwitchDisabled || !enabled }"
[class.disabled]="isChatSettingsSwitchDisabled"
(click)="onEnable()"
>
<div class="btn" [ngClass]="{ 'btn-success selected': enabled, 'btn-default': !enabled }" [class.disabled]="isSettingsSwitchDisabled" (click)="onEnable()">
{{ 'artemisApp.iris.settings.subSettings.enabled.on' | artemisTranslate }}
</div>
<div
class="btn"
[ngClass]="{ 'btn-danger selected': isChatSettingsSwitchDisabled || !enabled, 'btn-default': !isChatSettingsSwitchDisabled && enabled }"
[class.disabled]="isChatSettingsSwitchDisabled"
(click)="onDisable()"
>
<div class="btn" [ngClass]="{ 'btn-danger selected': !enabled, 'btn-default': enabled }" [class.disabled]="isSettingsSwitchDisabled" (click)="onDisable()">
{{ 'artemisApp.iris.settings.subSettings.enabled.off' | artemisTranslate }}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ export class IrisCommonSubSettingsUpdateComponent implements OnInit, OnChanges {
}
return false;
}
get isChatSettingsSwitchDisabled() {
get isSettingsSwitchDisabled() {
return this.inheritDisabled || (!this.isAdmin && this.settingsType !== this.EXERCISE);
}

protected readonly IrisSubSettings = IrisSubSettings;
protected readonly IrisSubSettingsType = IrisSubSettingsType;
protected readonly IrisSettingsType = IrisSettingsType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('IrisCommonSubSettingsUpdateComponent Component', () => {
fixture.detectChanges();

expect(comp.inheritDisabled).toBeTrue();
expect(comp.isChatSettingsSwitchDisabled).toBeTrue();
expect(comp.isSettingsSwitchDisabled).toBeTrue();
});

it('change allowed model', () => {
Expand Down

0 comments on commit 4b1f709

Please sign in to comment.