web/*: fix defaults for booleans to use first()

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-04-04 00:36:53 +02:00
parent 46e0571ed0
commit 8a7c414031
23 changed files with 54 additions and 39 deletions

View File

@ -8,6 +8,7 @@ import "../../../elements/forms/FormGroup";
import "../../../elements/forms/HorizontalFormElement";
import { ifDefined } from "lit-html/directives/if-defined";
import { until } from "lit-html/directives/until";
import { first } from "../../../utils";
@customElement("ak-source-oauth-form")
export class OAuthSourceForm extends Form<OAuthSource> {
@ -17,7 +18,7 @@ export class OAuthSourceForm extends Form<OAuthSource> {
slug: value,
}).then(source => {
this.source = source;
this.showUrlOptions = source.type?.urlsCustomizable || false;
this.showUrlOptions = first(source.type?.urlsCustomizable, false);
});
}
@ -105,7 +106,7 @@ export class OAuthSourceForm extends Form<OAuthSource> {
</ak-form-element-horizontal>
<ak-form-element-horizontal name="enabled">
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.source?.enabled || true}>
<input type="checkbox" class="pf-c-check__input" ?checked=${first(this.source?.enabled, true)}>
<label class="pf-c-check__label">
${t`Enabled`}
</label>