Skip to content

Commit

Permalink
Refactor CustomEditableFields (#565)
Browse files Browse the repository at this point in the history
* Refactor CustomEditableFields

* Update custom-editable-field.ts
  • Loading branch information
jeffdaley authored Jan 26, 2024
1 parent 6a0afb8 commit e050d6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions web/app/components/custom-editable-field.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="editable-field-container" ...attributes>
<EditableField
data-test-custom-field
data-test-custom-field-type={{if this.typeIsString "string" "people"}}
@value={{if this.typeIsString this.stringValue this.hermesUsers}}
data-test-custom-field-type={{if this.typeIsPeople "people" "string"}}
@value={{if this.typeIsPeople this.hermesUsers this.stringValue}}
@onChange={{if this.typeIsPeople this.onPeopleSelectChange}}
@onSave={{if this.typeIsPeople this.onPeopleSave @onSave}}
@isSaving={{@isSaving}}
Expand Down
8 changes: 4 additions & 4 deletions web/app/components/custom-editable-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ interface CustomEditableFieldComponentSignature {
}

export default class CustomEditableFieldComponent extends Component<CustomEditableFieldComponentSignature> {
protected get typeIsString() {
return this.args.attributes.type === "STRING";
}

/**
* Whether type of the field is `PEOPLE`.
* Used in the template to determine what to pass to `EditableField`.
*/
protected get typeIsPeople() {
return this.args.attributes.type === "PEOPLE";
}
Expand Down

0 comments on commit e050d6a

Please sign in to comment.