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

[5.x] Add collection title to select field #9749

Open
wants to merge 3 commits into
base: 5.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion resources/js/components/inputs/relationship/SelectField.vue
Expand Up @@ -32,7 +32,13 @@
v-bind="attributes"
>
</template>
<template #no-options>
<template #option="option">
<template v-if="hasMultipleCollections">
<span class="text-gray-700 mr-2">{{ option.collection.title }}</span>
</template>
{{ option.title }}
</template>
<template #no-options>
<div class="text-sm text-gray-700 rtl:text-right ltr:text-left py-2 px-4" v-text="__('No options to choose from.')" />
</template>
<template #footer="{ deselect }" v-if="multiple">
Expand Down Expand Up @@ -99,6 +105,10 @@ export default {
},

computed: {
hasMultipleCollections(){
return this.config.collections?.length > 1 || [...new Set(this.options.map(option => option?.collection?.handle))].length > 1;
},

isTaggable() {
if (data_get(this.config, 'create') === false) return false;

Expand Down