Skip to content

Commit

Permalink
#357: Rename property and refactor code.
Browse files Browse the repository at this point in the history
* Rename object property from editable to showValuesForEditing for a better naming.
* Remove unnecessary ternary operator to have the same functionality, but simpler.
  • Loading branch information
bnitsch committed May 24, 2024
1 parent b0db333 commit 79379da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/components/ParticipantList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ Licensed under the Elastic License 2.0. */
field: 'studyGroupId',
header: t('study.props.studyGroup'),
type: MoreTableFieldType.choice,
editable: { values: groupStatuses.value, editable: actionsVisible },
editable: {
values: groupStatuses.value,
showValuesForEditing: actionsVisible,
},
sortable: true,
filterable: { showFilterMatchModes: false },
placeholder: t('global.placeholder.noGroup'),
Expand Down
13 changes: 8 additions & 5 deletions src/components/shared/MoreTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,12 @@ Licensed under the Elastic License 2.0. */
typeof editable !== 'boolean' &&
typeof editable !== 'function'
) {
if (Object.prototype.hasOwnProperty.call(editable, 'editable')) {
return (editable as MoreTableChoiceOptions).editable ?? false;
if (
Object.prototype.hasOwnProperty.call(editable, 'showValuesForEditing')
) {
return (
(editable as MoreTableChoiceOptions).showValuesForEditing ?? false
);
}
}
Expand Down Expand Up @@ -673,9 +677,8 @@ Licensed under the Elastic License 2.0. */
column.editable as MoreTableChoiceOptions,
),
)
: column.placeholder
? column.placeholder
: $t('global.placeholder.chooseDropdownOptionDefault')
: column.placeholder ||
$t('global.placeholder.chooseDropdownOptionDefault')
"
/>
<span v-else>{{
Expand Down
2 changes: 1 addition & 1 deletion src/models/MoreTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface MoreTableFilterOption {
export interface MoreTableChoiceOptions {
values: MoreTableChoice[];
placeholder?: string;
editable?: boolean;
showValuesForEditing?: boolean;
}
export interface MoreTableChoice {
label: string;
Expand Down

0 comments on commit 79379da

Please sign in to comment.