Skip to content

Commit

Permalink
Fixed add button ids for array values
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Oct 21, 2022
1 parent fb8a2f9 commit 64cdc99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/src/app/form/component/AddButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import Button from "react-bootstrap/Button";
import Translate from "../../i18n/components/translate";

const AddButton = ({className, ...props}) => (
<>
<Button {...props} variant="success" className={`array-add-button ${ className }`} size="sm">
<Translate value="action.add" />&nbsp;
<FontAwesomeIcon icon={faPlus} />
</Button>
</>
);
export default AddButton;
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const StringListWithDefaultField = ({
required={props.required}
/>}
<AddButton
id={`array-field-addbtn-${props.idSchema.$id}`}
className="array-item-add mx-2"
onClick={onAdd}
disabled={props.disabled || props.readonly}
Expand Down
3 changes: 3 additions & 0 deletions ui/src/app/form/component/templates/ArrayFieldTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ const DefaultFixedArrayFieldTemplate = (props) => {
title={props.uiSchema["ui:title"] || props.title}
required={props.required}
/>
hi there
{props.canAdd && (
<AddButton
id={`array-field-addbtn-${props.idSchema.$id}`}
className="array-item-add"
onClick={props.onAddClick}
disabled={props.disabled || props.readonly}
Expand Down Expand Up @@ -266,6 +268,7 @@ const DefaultNormalArrayFieldTemplate = (props) => {
/>}
{props.canAdd && (
<AddButton
id={`array-field-addbtn-${props.idSchema.$id}`}
className="array-item-add mx-2"
onClick={props.onAddClick}
disabled={props.disabled || props.readonly}
Expand Down

0 comments on commit 64cdc99

Please sign in to comment.