Skip to content

Commit

Permalink
Show edit drawer as preview for disabled many to one (#13207)
Browse files Browse the repository at this point in the history
Fixes #13201
  • Loading branch information
rijkvanzanten committed May 10, 2022
1 parent 51e90f6 commit a9422b2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions app/src/interfaces/select-dropdown-m2o/select-dropdown-m2o.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
</div>
</template>

<template v-if="!disabled" #append>
<template #append>
<template v-if="displayItem">
<v-icon v-tooltip="t('edit')" name="open_in_new" class="edit" @click.stop="editModalActive = true" />
<v-icon
v-if="updateAllowed"
v-tooltip="t('edit')"
name="open_in_new"
class="edit"
@click.stop="editModalActive = true"
v-if="!disabled"
v-tooltip="t('deselect')"
name="close"
class="deselect"
@click.stop="$emit('input', null)"
/>
<v-icon v-tooltip="t('deselect')" name="close" class="deselect" @click.stop="$emit('input', null)" />
</template>
<template v-else>
<v-icon
Expand All @@ -43,13 +43,13 @@
</v-input>

<drawer-item
v-if="!disabled"
v-model:active="editModalActive"
:collection="relationInfo.relatedCollection.collection"
:primary-key="currentPrimaryKey"
:edits="edits"
:circular-field="relationInfo.relation.meta?.one_field ?? undefined"
@input="update"
:disabled="!updateAllowed || disabled"
@input="onDrawerItemInput"
/>
<drawer-collection
Expand Down Expand Up @@ -175,6 +175,11 @@ function onPreviewClick() {
selectModalActive.value = true;
}
function onDrawerItemInput(event: any) {
if (props.disabled) return;
update(event);
}
const selection = computed<(number | string)[]>(() => {
const pkField = relationInfo.value?.relatedPrimaryKeyField.field;
Expand Down

0 comments on commit a9422b2

Please sign in to comment.