From 3277405d430fbb2b8178dfa2eaeaa223cbe3cbc8 Mon Sep 17 00:00:00 2001 From: Daniel Biegler Date: Mon, 22 Jan 2024 17:06:28 +0100 Subject: [PATCH] Add option in translation interface for opening the splitview by default (#21160) --- .changeset/chilled-adults-arrive.md | 5 +++++ app/src/interfaces/translations/index.ts | 15 +++++++++++++++ app/src/interfaces/translations/translations.vue | 6 ++++-- app/src/lang/translations/en-US.yaml | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .changeset/chilled-adults-arrive.md diff --git a/.changeset/chilled-adults-arrive.md b/.changeset/chilled-adults-arrive.md new file mode 100644 index 0000000000..d2a59f6757 --- /dev/null +++ b/.changeset/chilled-adults-arrive.md @@ -0,0 +1,5 @@ +--- +'@directus/app': patch +--- + +Added option in the translation interface for opening the splitview by default diff --git a/app/src/interfaces/translations/index.ts b/app/src/interfaces/translations/index.ts index b7c501778f..7161e5bee8 100644 --- a/app/src/interfaces/translations/index.ts +++ b/app/src/interfaces/translations/index.ts @@ -80,6 +80,21 @@ export default defineInterface({ width: 'half', }, }, + { + field: 'defaultOpenSplitView', + name: '$t:interfaces.translations.default_split_view_state', + type: 'boolean', + schema: { + default_value: false, + }, + meta: { + interface: 'toggle', + options: { + label: '$t:start_open', + }, + width: 'half', + }, + }, ]; }, preview: PreviewSVG, diff --git a/app/src/interfaces/translations/translations.vue b/app/src/interfaces/translations/translations.vue index 843860c385..741075db10 100644 --- a/app/src/interfaces/translations/translations.vue +++ b/app/src/interfaces/translations/translations.vue @@ -11,11 +11,11 @@ import { useFieldsStore } from '@/stores/fields'; import { usePermissionsStore } from '@/stores/permissions'; import { fetchAll } from '@/utils/fetch-all'; import { unexpectedError } from '@/utils/unexpected-error'; +import { getEndpoint } from '@directus/utils'; import { cloneDeep, isNil } from 'lodash'; import { computed, ref, toRefs, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import LanguageSelect from './language-select.vue'; -import { getEndpoint } from '@directus/utils'; const props = withDefaults( defineProps<{ @@ -25,6 +25,7 @@ const props = withDefaults( languageField?: string | null; languageDirectionField?: string | null; defaultLanguage?: string | null; + defaultOpenSplitView?: boolean; userLanguage?: boolean; value: (number | string | Record)[] | Record; autofocus?: boolean; @@ -37,6 +38,7 @@ const props = withDefaults( autofocus: false, disabled: false, defaultLanguage: null, + defaultOpenSplitView: false, userLanguage: false, }, ); @@ -59,7 +61,7 @@ const permissionsStore = usePermissionsStore(); const { width } = useWindowSize(); -const splitView = ref(false); +const splitView = ref(props.defaultOpenSplitView); const firstLang = ref(); const secondLang = ref(); diff --git a/app/src/lang/translations/en-US.yaml b/app/src/lang/translations/en-US.yaml index 1fdbe8511f..3af40dd049 100644 --- a/app/src/lang/translations/en-US.yaml +++ b/app/src/lang/translations/en-US.yaml @@ -1872,6 +1872,7 @@ interfaces: no_collection: No Collection toggle_split_view: Toggle Split View enable: Enable + default_split_view_state: Default Split View State user_language: Use Current User Language default_language: Default Language language_field: Language Indicator Field