Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Allow disabled input on spot-toggle

Oliver Günther066894c91b9b
diff --git a/frontend/src/app/spot/components/toggle/toggle.component.html b/frontend/src/app/spot/components/toggle/toggle.component.html
index 3d21dd369cf..49c7cd3de4f 100644
--- a/frontend/src/app/spot/components/toggle/toggle.component.html
+++ b/frontend/src/app/spot/components/toggle/toggle.component.html
@@ -1,12 +1,14 @@
<label
*ngFor="let option of options"
- [ngClass]="{ 'button': true, 'form--field-inline-button': true, '-active': value === option.value }"
+ [ngClass]="{ 'button': true, '-disabled': disabled, 'form--field-inline-button': true, '-active': value === option.value }"
data-qa-selector="spot-toggle--option"
+ [attr.data-qa-disabled]="disabled || undefined"
[attr.data-qa-active-toggle]="value === option.value"
>
<input
class="spot-toggle--option-input"
type="radio"
+ [disabled]="disabled"
[name]="name"
[value]="option.value"
[ngModel]="value"
diff --git a/frontend/src/app/spot/components/toggle/toggle.component.ts b/frontend/src/app/spot/components/toggle/toggle.component.ts
index 4e7a4bf708c..81f8062b96a 100644
--- a/frontend/src/app/spot/components/toggle/toggle.component.ts
+++ b/frontend/src/app/spot/components/toggle/toggle.component.ts
@@ -33,6 +33,8 @@ export class SpotToggleComponent<T> implements ControlValueAccessor {
@Input() options:SpotToggleOption<T>[] = [];
+ @Input() disabled = false;
+
@Input() name = `spot-toggle-${+(new Date())}`;
@Input() public value:T;