Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CustomEditableFields #565

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading