web/flows: fix checkboxes not being rendered correctly
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2d8b4f543b
commit
6237352e25
|
@ -64,13 +64,6 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
|
||||||
placeholder="${prompt.placeholder}"
|
placeholder="${prompt.placeholder}"
|
||||||
class="pf-c-form-control"
|
class="pf-c-form-control"
|
||||||
?required=${prompt.required}>`;
|
?required=${prompt.required}>`;
|
||||||
case "checkbox":
|
|
||||||
return `<input
|
|
||||||
type="checkbox"
|
|
||||||
name="${prompt.fieldKey}"
|
|
||||||
placeholder="${prompt.placeholder}"
|
|
||||||
class="pf-c-form-control"
|
|
||||||
?required=${prompt.required}>`;
|
|
||||||
case "date":
|
case "date":
|
||||||
return `<input
|
return `<input
|
||||||
type="date"
|
type="date"
|
||||||
|
@ -115,6 +108,22 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
${this.challenge.fields.map((prompt) => {
|
${this.challenge.fields.map((prompt) => {
|
||||||
|
// Checkbox is rendered differently
|
||||||
|
if (prompt.type === "checkbox") {
|
||||||
|
return html`<div class="pf-c-check">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="pf-c-check__input"
|
||||||
|
name="${prompt.fieldKey}"
|
||||||
|
?checked=${prompt.placeholder !== ""}
|
||||||
|
?required=${prompt.required}
|
||||||
|
/>
|
||||||
|
<label class="pf-c-check__label">${prompt.label}</label>
|
||||||
|
${prompt.required
|
||||||
|
? html`<p class="pf-c-form__helper-text">${t`Required.`}</p>`
|
||||||
|
: html``}
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
// Special types that aren't rendered in a wrapper
|
// Special types that aren't rendered in a wrapper
|
||||||
if (
|
if (
|
||||||
prompt.type === "static" ||
|
prompt.type === "static" ||
|
||||||
|
|
|
@ -157,7 +157,7 @@ export class PromptForm extends ModelForm<Prompt, string> {
|
||||||
<ak-form-element-horizontal label=${t`Order`} ?required=${true} name="order">
|
<ak-form-element-horizontal label=${t`Order`} ?required=${true} name="order">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value="${ifDefined(this.instance?.order)}"
|
value="${first(this.instance?.order, 0)}"
|
||||||
class="pf-c-form-control"
|
class="pf-c-form-control"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
Reference in New Issue