web/user: fix static prompt fields being rendered with label
closes #2584 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
335131affc
commit
4ed8171130
|
@ -133,6 +133,18 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
|
||||||
return html`<p class="pf-c-form__helper-text">${unsafeHTML(prompt.subText)}</p>`;
|
return html`<p class="pf-c-form__helper-text">${unsafeHTML(prompt.subText)}</p>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldRenderInWrapper(prompt: StagePrompt): bool {
|
||||||
|
// Special types that aren't rendered in a wrapper
|
||||||
|
if (
|
||||||
|
prompt.type === PromptTypeEnum.Static ||
|
||||||
|
prompt.type === PromptTypeEnum.Hidden ||
|
||||||
|
prompt.type === PromptTypeEnum.Separator
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
renderField(prompt: StagePrompt): TemplateResult {
|
renderField(prompt: StagePrompt): TemplateResult {
|
||||||
// Checkbox is rendered differently
|
// Checkbox is rendered differently
|
||||||
if (prompt.type === PromptTypeEnum.Checkbox) {
|
if (prompt.type === PromptTypeEnum.Checkbox) {
|
||||||
|
@ -151,17 +163,7 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
|
||||||
<p class="pf-c-form__helper-text">${unsafeHTML(prompt.subText)}</p>
|
<p class="pf-c-form__helper-text">${unsafeHTML(prompt.subText)}</p>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
// Special types that aren't rendered in a wrapper
|
if (this.shouldRenderInWrapper(prompt)) {
|
||||||
if (
|
|
||||||
prompt.type === PromptTypeEnum.Static ||
|
|
||||||
prompt.type === PromptTypeEnum.Hidden ||
|
|
||||||
prompt.type === PromptTypeEnum.Separator
|
|
||||||
) {
|
|
||||||
return html`
|
|
||||||
${unsafeHTML(this.renderPromptInner(prompt, false))}
|
|
||||||
${this.renderPromptHelpText(prompt)}
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
return html`<ak-form-element
|
return html`<ak-form-element
|
||||||
label="${prompt.label}"
|
label="${prompt.label}"
|
||||||
?required="${prompt.required}"
|
?required="${prompt.required}"
|
||||||
|
@ -172,6 +174,9 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
|
||||||
${this.renderPromptHelpText(prompt)}
|
${this.renderPromptHelpText(prompt)}
|
||||||
</ak-form-element>`;
|
</ak-form-element>`;
|
||||||
}
|
}
|
||||||
|
return html` ${unsafeHTML(this.renderPromptInner(prompt, false))}
|
||||||
|
${this.renderPromptHelpText(prompt)}`;
|
||||||
|
}
|
||||||
|
|
||||||
renderContinue(): TemplateResult {
|
renderContinue(): TemplateResult {
|
||||||
return html` <div class="pf-c-form__group pf-m-action">
|
return html` <div class="pf-c-form__group pf-m-action">
|
||||||
|
|
|
@ -36,6 +36,7 @@ export class UserSettingsPromptStage extends PromptStage {
|
||||||
|
|
||||||
renderField(prompt: StagePrompt): TemplateResult {
|
renderField(prompt: StagePrompt): TemplateResult {
|
||||||
const errors = (this.challenge?.responseErrors || {})[prompt.fieldKey];
|
const errors = (this.challenge?.responseErrors || {})[prompt.fieldKey];
|
||||||
|
if (this.shouldRenderInWrapper(prompt)) {
|
||||||
return html`
|
return html`
|
||||||
<ak-form-element-horizontal
|
<ak-form-element-horizontal
|
||||||
label=${t`${prompt.label}`}
|
label=${t`${prompt.label}`}
|
||||||
|
@ -51,6 +52,10 @@ export class UserSettingsPromptStage extends PromptStage {
|
||||||
</ak-form-element-horizontal>
|
</ak-form-element-horizontal>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
return html`
|
||||||
|
${unsafeHTML(this.renderPromptInner(prompt, true))} ${this.renderPromptHelpText(prompt)}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
renderContinue(): TemplateResult {
|
renderContinue(): TemplateResult {
|
||||||
return html` <div class="pf-c-form__group pf-m-action">
|
return html` <div class="pf-c-form__group pf-m-action">
|
||||||
|
|
Reference in New Issue