* fix: 🐛 refactor info-field component Overall context of how the `<InfoField/>` was changed to the correct order. Corrected css grid to have the order of `label,input-field,helper-text`. Also refactored all component instances affected by the change. * refactor: 💡 refactor styling for icon to be center refactor will get the icon as close to center as possible.
112 lines
3.2 KiB
Handlebars
112 lines
3.2 KiB
Handlebars
<Rose::Form
|
|
@onSubmit={{@submit}}
|
|
@cancel={{@cancel}}
|
|
@disabled={{@model.isSaving}}
|
|
@showEditToggle={{if @model.isNew false true}}
|
|
as |form|
|
|
>
|
|
|
|
<form.input
|
|
@name='name'
|
|
@value={{@model.name}}
|
|
@label={{t 'form.name.label'}}
|
|
@error={{@model.errors.name}}
|
|
@helperText={{t 'form.name.help'}}
|
|
as |field|
|
|
>
|
|
{{#if @model.errors.name}}
|
|
<field.errors as |errors|>
|
|
{{#each @model.errors.name as |error|}}
|
|
<errors.message>{{error.message}}</errors.message>
|
|
{{/each}}
|
|
</field.errors>
|
|
{{/if}}
|
|
</form.input>
|
|
|
|
<form.textarea
|
|
@name='description'
|
|
@value={{@model.description}}
|
|
@label={{t 'form.description.label'}}
|
|
@error={{@model.errors.description}}
|
|
@helperText={{t 'form.description.help'}}
|
|
as |field|
|
|
>
|
|
{{#if @model.errors.description}}
|
|
<field.errors as |errors|>
|
|
{{#each @model.errors.description as |error|}}
|
|
<errors.message>{{error.message}}</errors.message>
|
|
{{/each}}
|
|
</field.errors>
|
|
{{/if}}
|
|
</form.textarea>
|
|
|
|
{{#if @model.isNew}}
|
|
<form.fieldset>
|
|
<:body>
|
|
<Hds::Form::RadioCard::Group as |G|>
|
|
<G.Legend>{{t 'form.type.label'}}</G.Legend>
|
|
{{#each @types as |credentialType|}}
|
|
<G.RadioCard
|
|
@name={{credentialType}}
|
|
@value={{credentialType}}
|
|
@checked={{eq credentialType @model.type}}
|
|
@maxWidth='20rem'
|
|
{{on 'input' (fn @changeType credentialType)}}
|
|
as |R|
|
|
>
|
|
<R.Label>{{t
|
|
(concat 'resources.credential.types.' credentialType)
|
|
}}</R.Label>
|
|
<R.Description>{{t
|
|
(concat 'resources.credential.help.' credentialType)
|
|
}}</R.Description>
|
|
</G.RadioCard>
|
|
{{/each}}
|
|
</Hds::Form::RadioCard::Group>
|
|
</:body>
|
|
</form.fieldset>
|
|
|
|
<form.fieldset>
|
|
<:title>{{t 'resources.credential.form.json.label'}}</:title>
|
|
<:description>{{t 'resources.credential.form.json.help'}}</:description>
|
|
<:body>
|
|
<Form::Field::JsonSecret
|
|
@value={{@model.json_object}}
|
|
@onInput={{fn (mut @model.json_object)}}
|
|
@showEditButton={{false}}
|
|
/>
|
|
</:body>
|
|
</form.fieldset>
|
|
{{else}}
|
|
<InfoField
|
|
@value={{t (concat 'resources.credential.types.' @model.type)}}
|
|
as |F|
|
|
>
|
|
<F.Label>{{t 'form.type.label'}}</F.Label>
|
|
<F.HelperText>{{t (concat 'resources.credential.help.' @model.type)}}
|
|
</F.HelperText>
|
|
</InfoField>
|
|
|
|
<form.fieldset>
|
|
<:title>{{t 'resources.credential.form.json.label'}}</:title>
|
|
<:description>{{t 'resources.credential.form.json.help'}}</:description>
|
|
<:body>
|
|
<Form::Field::JsonSecret
|
|
@disabled={{form.disabled}}
|
|
@value={{@model.json_object}}
|
|
@onInput={{fn (mut @model.json_object)}}
|
|
@showEditButton={{true}}
|
|
/>
|
|
</:body>
|
|
</form.fieldset>
|
|
{{/if}}
|
|
|
|
{{#if (can 'save model' @model)}}
|
|
<form.actions
|
|
@enableEditText={{t 'actions.edit-form'}}
|
|
@submitText={{t 'actions.save'}}
|
|
@cancelText={{t 'actions.cancel'}}
|
|
/>
|
|
{{/if}}
|
|
|
|
</Rose::Form> |