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] Render HTML for dictionary fields in listings #11088

Merged
merged 1 commit into from
Nov 7, 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
2 changes: 2 additions & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import TitleFormats from '../components/collections/TitleFormats.vue';
import ColorFieldtype from '../components/fieldtypes/ColorFieldtype.vue';
import DateFieldtype from '../components/fieldtypes/DateFieldtype.vue';
import DictionaryFieldtype from "../components/fieldtypes/DictionaryFieldtype.vue";
import DictionaryIndexFieldtype from "../components/fieldtypes/DictionaryIndexFieldtype.vue";
import DictionaryFields from "../components/fieldtypes/DictionaryFields.vue";
import FieldDisplayFieldtype from '../components/fieldtypes/FieldDisplayFieldtype.vue';
import FieldsFieldtype from '../components/fieldtypes/grid/FieldsFieldtype.vue';
Expand Down Expand Up @@ -89,6 +90,7 @@ Vue.component('collection_title_formats-fieldtype', TitleFormats);
Vue.component('color-fieldtype', ColorFieldtype);
Vue.component('date-fieldtype', DateFieldtype);
Vue.component('dictionary-fieldtype', DictionaryFieldtype);
Vue.component('dictionary-fieldtype-index', DictionaryIndexFieldtype);
Vue.component('dictionary_fields-fieldtype', DictionaryFields);
Vue.component('field_display-fieldtype', FieldDisplayFieldtype);
Vue.component('fields-fieldtype', FieldsFieldtype);
Expand Down
19 changes: 19 additions & 0 deletions resources/js/components/fieldtypes/DictionaryIndexFieldtype.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<div class="text-ellipsis" v-html="formatted" />
</template>

<script>
export default {

mixins: [IndexFieldtype],

computed: {
formatted() {
if (!this.value) {
return null;
}
return this.value.join(', ');
},
},
};
</script>
1 change: 0 additions & 1 deletion src/Fieldtypes/Dictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Dictionary extends Fieldtype
{
protected $categories = ['controls', 'relationship'];
protected $selectableInForms = true;
protected $indexComponent = 'tags';

protected function configFieldItems(): array
{
Expand Down
Loading